aptabase / aptabase-swift

Swift SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps
https://aptabase.com
MIT License
21 stars 8 forks source link

Added support for ObjC and Sample project with UIKit and ObjC #4

Closed mladjan closed 1 year ago

mladjan commented 1 year ago

Yes, then we can use it, and will be cleaner

On Tue, 20 Jun 2023 at 10:49, Guilherme Oenning @.***> wrote:

@.**** commented on this pull request.

In Sources/Aptabase/Aptabase.swift https://github.com/aptabase/aptabase-swift/pull/4#discussion_r1234949180 :

@@ -50,6 +51,12 @@ public class Aptabase { env = EnvironmentInfo.get() }

+

  • @objc
  • public func initialize(appKey: String) {

so if we turn InitOptions into a class we could use on both Swift and ObjC? If so, that might be a better option

— Reply to this email directly, view it on GitHub https://github.com/aptabase/aptabase-swift/pull/4#discussion_r1234949180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADPTEFT4IKI5X42DYQCW4DXMFPYJANCNFSM6AAAAAAZMB45V4 . You are receiving this because you authored the thread.Message ID: @.***>

--

goenning commented 1 year ago

👍 Do you want to make that change as part of this PR?

As for the Value type, if that's not supported in ObjC, could we use Value on Swift and Any on ObjC?

mladjan commented 1 year ago

I will try to make changes with class instead of struct. Regarding Value, it's not supported in OjbC, and needs to be used Any. But if we don't want to have two methods, we need to stick with Any.

goenning commented 1 year ago

I think it would be okay to have a different signature for ObjC. I suppose we could still have a single implementation to avoid code duplicates?

mladjan commented 1 year ago

I have tried to reuse struct as class, but for some unknown reason, doesn't work :\

goenning commented 1 year ago

I pushed a commit to this PR if you want to have a look. It seems to be working with the class. How does it compare to your solution? Maybe I missed something?

goenning commented 1 year ago

Should be available on version 0.2.0 now :)

Thanks again for the PR!