Messagekit: Initiating Cells

Created on 25 Jul 2018  路  2Comments  路  Source: MessageKit/MessageKit

Hi there! I used the custom cells guide and currently have the custom cells I want implemented. I just had a question about the initialization and usage of these cells. This might be a very basic doubt but I am really new to Swift so please excuse me!

Think it might make things easier to first show what's going on.

This is the init function for my custom message cell, introBtns:
screen shot 2018-07-25 at 11 15 35 am

And this is where I create a message of the introBtns type, with its initializer:
screen shot 2018-07-25 at 11 14 56 am

How do I use the "hello world" string passed in? When I print the value of message.kind in my custom cell class, I see it ouputs followUpBtns(Optional("hello world")), but how can I extract just the string itself?

I honestly feel that is a really dumb question but I don't understand where the arguments for the self.init function are defined and how I can modify them.

question

Most helpful comment

switch message.kind {
case .introBtns(let text):
// Text=hello world
default:
// Handle non custom kinds
}

Sent with GitHawk

All 2 comments

switch message.kind {
case .introBtns(let text):
// Text=hello world
default:
// Handle non custom kinds
}

Sent with GitHawk

Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NiklasWilson picture NiklasWilson  路  4Comments

omaralbeik picture omaralbeik  路  4Comments

robertoferraz picture robertoferraz  路  3Comments

mlequeux picture mlequeux  路  3Comments

pawankmrai picture pawankmrai  路  3Comments