mbarnach / SwiftySlack

Create Slack messages in Swift.
Apache License 2.0
9 stars 4 forks source link

Button example #4

Closed thatvirtualboy closed 1 year ago

thatvirtualboy commented 1 year ago

Using your example in a SwiftUI button gives the error: Cannot find 'blocks' in scope in the Message() What am I missing?

Button example:

 Button(action: {
                    // Create a block:
                    let section = SectionBlock(text: Text("A message *with some bold text* and _some italicized text_."))

                    // Create the message:
                    let message = Message(blocks: blocks, to: "#general", alternateText: "A message.")

                    // Send the message:
                    let webAPI = WebAPI(token: "xoxb-123456789")
                    webAPI.send(message: message)
                }) {
                    Label("Submit", systemImage: "paperplane")
            }

EDIT: Just saw your Tests folder. Which example should I follow for sending the most basic message?

thatvirtualboy commented 1 year ago

Resolved