Open kusc-leica opened 2 days ago
I had a small look regarding the change and found out that:
@objc
should be enough. @objcMembers
has to be applied to expose all members (or annotate the class + all methods individually with @objc
)AFAIK the ObjC interop stuff is currently the only way to consume Swift libraries in platforms like MAUI/Xamarin. Also all other "technology wrappers" need to do some heavy lifting due to that (partly duplicating the whole public API).
I am open for any solution which brings us forward using this SDK without duplicating and maintaining an own whole library which needs to keep up with any changes on the main lib.
Hi @kusc-leica,
Indeed, the latest version of Notificare doesn't expose the Public API to Objective-C, but neither did the previous versions. This is by design so we can provide the best DX for Swift developers.
As you mentioned, other "technology wrappers" (Flutter, React Native, etc.) all have a bridging mechanism but are not auto-generated like in MAUI. This has disadvantages, like needing changes to keep up with the native libraries, but it does support Swift.
Unless MAUI decides to support Swift — by reading the Swift module map instead of the bridging header — I think the only solution is to have a proxy library that exposes Swift-only features in a compatible manner for Objective-C/MAUI consumption.
That being said, I'm discussing this with the team so we can find a path forward. I'll keep you posted.
Great, thanks for the fast reply and following up internally. Unfortunately I have no info yet from the mobile app development team what exact classes and methods we would need. Roughly it would be the areas around push notificiations and inbox. For iOS this means things around those Kits:
I think hardly any technology wrapper supports Swift directly as the required native library exports are not addressable in a way. AFAIK ObjectiveC interop is exactly the only official way to interop with Swift. Some frameworks of course have extended tooling to integrate with Swift in some way.
Its just a bit unfortunate that ObjectiveC interop doesn't support structs, otherwise it would really just be a matter of adding annotations.😞
Hi Daniel,
Upon further discussion with the development team, we cannot address this simply at the native library level. Changing all the Public APIs to be compliant with Objective-C would be an impactful breaking change and introduce several other problems for Swift consumers.
On the other hand, we would love to investigate this further to support MAUI. However, as we mentioned in the past, we can't take this to management and prioritise any analysis without having you as a client. I would recommend discussing this internally and maybe reaching out to sales.
For the time being, would you be able to look into this yourself?
Our management and sales are currently in progress to become a paying customer (due to holidays things are shifting a bit).
As shared: we are working on the SDK over here: https://github.com/hexagon-geo-surv/notificare-sdk-maui
On the feature branch (open PR) you can see the attempt to generate the iOS bindings with Objective Sharpie. Also of interest: I reached out to Microsoft over here: https://github.com/xamarin/xamarin-macios/issues/21549
With ObjectiveC becoming more and more a rare thing in the iOS world, some Swift tooling is needed. I found some interesting bits where the .abi.json
could be used to generate the C# code.
Is there an existing issue for this?
Describe the bug
We want to auto generate MAUI bindings for iOS using Objective Sharpie. This tooling uses the Header files generate the required glue code.
Unfortunately the latest Notificare SDK is missing the
@objc
attribute for the public interface making the classes unavailable in both ObjectiveC but also for other tooling.Some random classes seem to have the attribute but it doesn't seem to be used really properly as intended.
Steps to reproduce
Notificare\NotificareKit.xcframework\ios-arm64\NotificareKit.framework\Headers\NotificareKit-Swift.h
Expected behaviour
The headers should contain definitions for all types intended to be used by integrators like: https://github.com/Notificare/notificare-sdk-ios/blob/bb402ce540e2a713ec604afd963e64470f8042f1/NotificareKit/Sources/Notificare.swift#L9
Relevant log output
Library version
4.0.0
Operating system
(not relevant)
Smartphone model
(not relevant)
Additional context
With addiing the proper attributes, also usage from ObjectiveC might be possible again. Currently you are forced to write your app in Swift.
I checked a bit the other platforms wrapping the iOS library and it seems they all are somehow again creating additional custom wrappers to expose some aspects.
https://github.com/Notificare/notificare-sdk-ionic-native/blob/main/packages/capacitor-notificare/ios/Plugin/NotificarePlugin.m https://github.com/Notificare/notificare-sdk-flutter/blob/main/notificare_push/ios/Classes/NotificarePushPlugin.m https://github.com/Notificare/notificare-sdk-flutter/blob/main/notificare_push/ios/Classes/SwiftNotificarePushPlugin.swift https://github.com/Notificare/notificare-sdk-react-native/blob/main/packages/react-native-notificare/ios/NotificareModule.mm
Unfortunately this is a major blocker for us as we cannot adopt Notificare for our needs.