Post

Replies

Boosts

Views

Activity

Comment on How to store one line of code from class into a button action?
I know my problem already but I dont know how to fix it. How do i call my function that is in final class -> init() ?? I tried calling empty functions outside of init() on button action and it works, only func within the init() is not recognise? How do I globalize the function that is in the init(). The whole socket set up is in the init(). Therefore, i cant pull the func out of init() as it will cause error.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Comment on How to store one line of code from class into a button action?
Hi, Yes, its the receiving part from server code. I am able to receive from server so i did not show it here. Currently, From Swiftui, I can receive continuously from JSON (Server) side and can only send the message once from SwiftUI to JSON when the network is connected. Im stuck at the part where whenever I click the button on swiftui, it will send a fixed msg. Continuous. I created the function in the final class but when i write it in the button`s (action: sendMsg), the xcode says "Cannot find 'sendMsg' in scope'. I tried creating the send function outside of the class and I got a lot of error. I am new to Xcode. How do I create the function globally? So that the content view will recognise my function that is in the final class init?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Comment on How do I add pins and other annotations to the new SwiftUI Map view for iOS 14
Did u manage to solve it? Im struggling at this now. Pls share senpai
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21
Comment on How to store one line of code from class into a button action?
I know my problem already but I dont know how to fix it. How do i call my function that is in final class -> init() ?? I tried calling empty functions outside of init() on button action and it works, only func within the init() is not recognise? How do I globalize the function that is in the init(). The whole socket set up is in the init(). Therefore, i cant pull the func out of init() as it will cause error.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Comment on How to store one line of code from class into a button action?
Hi, Yes, its the receiving part from server code. I am able to receive from server so i did not show it here. Currently, From Swiftui, I can receive continuously from JSON (Server) side and can only send the message once from SwiftUI to JSON when the network is connected. Im stuck at the part where whenever I click the button on swiftui, it will send a fixed msg. Continuous. I created the function in the final class but when i write it in the button`s (action: sendMsg), the xcode says "Cannot find 'sendMsg' in scope'. I tried creating the send function outside of the class and I got a lot of error. I am new to Xcode. How do I create the function globally? So that the content view will recognise my function that is in the final class init?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Comment on How to store one line of code from class into a button action?
Here is the SocketManager class definition, let me know if i gave you the wrong one. I got it from the SocketIO Package-> Source->Manager->SocketManager.swift https://github.com/socketio/socket.io-client-swift/blob/master/Source/SocketIO/Manager/SocketManager.swift Sorry the definition exceeded the number of characters, I have paste the link here.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Comment on How do I send a 1/0 signal via Wifi/ Communicating between 2 apple products
Hi @Hoffman, thank you! The links you shared were useful! The key word is Multi Peer Connectivity.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21