The Cocoamessage function is very useful for macOS users, but over time, Cocoa has been progressively phased out. Will a future version of PB support an equivalent for Swift functions?
Thank you
SwiftMessage function the horizon?
Re: SwiftMessage function the horizon?
Did you encounter any methods you can't call ?
From what I understand both Swift and Objective-C use objc_msgSend which is also what CocoaMessage does.
From what I understand both Swift and Objective-C use objc_msgSend which is also what CocoaMessage does.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: SwiftMessage function the horizon?
Good to know. It seems some functions like the Swift UI's switch button toggle may only be available in Swift, but I could be wrong.
Re: SwiftMessage function the horizon?
This isn't strictly accurate.wilbert wrote: Sun Jun 02, 2024 4:58 pm Did you encounter any methods you can't call ?
From what I understand both Swift and Objective-C use objc_msgSend which is also what CocoaMessage does.
Swift code can interop with Obj-C APIs relatively simply (using objc_* / sel_* / class_* functions under-the-hood), but there do exist some Swift-only APIs which are unavailable to Obj-C (at least trivially speaking, i.e., they lack Obj-C runtime bridging).
In general, Swift is less dynamic than Obj-C. So for something like SwiftUI, you'd import functions directly from the framework and call them in accordance with the Swift calling convention. You can do this in PureBasic (or C/Obj-C/etc.), but it'll be somewhat of a pain using anything but Swift as you've got to care for runtime specifics, name (de)mangling, etc. For this same reason, a SwiftMessage(...) function makes less sense.
Re: SwiftMessage function the horizon?
Thank you for clarifying