Skip to content

Commit 9eed849

Browse files
authored
Added objc support. (#1)
1 parent 1de84d9 commit 9eed849

File tree

5 files changed

+46
-35
lines changed

5 files changed

+46
-35
lines changed

Example/BasicExample/BasicExample.xcodeproj/project.pbxproj

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
465ACC5F27D01A510025BD02 /* SegmentAppsFlyer in Frameworks */ = {isa = PBXBuildFile; productRef = 465ACC5E27D01A510025BD02 /* SegmentAppsFlyer */; };
1110
46EDC6F627C6B8D100B870D7 /* BasicExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC6F527C6B8D100B870D7 /* BasicExampleApp.swift */; };
1211
46EDC6F827C6B8D100B870D7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC6F727C6B8D100B870D7 /* ContentView.swift */; };
1312
46EDC6FA27C6B8D200B870D7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 46EDC6F927C6B8D200B870D7 /* Assets.xcassets */; };
1413
46EDC6FD27C6B8D200B870D7 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 46EDC6FC27C6B8D200B870D7 /* Preview Assets.xcassets */; };
1514
46EDC70727C6B8D200B870D7 /* BasicExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC70627C6B8D200B870D7 /* BasicExampleTests.swift */; };
1615
46EDC71127C6B8D200B870D7 /* BasicExampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC71027C6B8D200B870D7 /* BasicExampleUITests.swift */; };
1716
46EDC71327C6B8D200B870D7 /* BasicExampleUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC71227C6B8D200B870D7 /* BasicExampleUITestsLaunchTests.swift */; };
18-
46EDC72127C6B92C00B870D7 /* Segment in Frameworks */ = {isa = PBXBuildFile; productRef = 46EDC72027C6B92C00B870D7 /* Segment */; };
17+
EA64AC7329D31296009F2F53 /* Segment in Frameworks */ = {isa = PBXBuildFile; productRef = EA64AC7229D31296009F2F53 /* Segment */; };
18+
EA64AC7529D3129A009F2F53 /* SegmentAppsFlyer in Frameworks */ = {isa = PBXBuildFile; productRef = EA64AC7429D3129A009F2F53 /* SegmentAppsFlyer */; };
1919
/* End PBXBuildFile section */
2020

2121
/* Begin PBXContainerItemProxy section */
@@ -53,8 +53,8 @@
5353
isa = PBXFrameworksBuildPhase;
5454
buildActionMask = 2147483647;
5555
files = (
56-
46EDC72127C6B92C00B870D7 /* Segment in Frameworks */,
57-
465ACC5F27D01A510025BD02 /* SegmentAppsFlyer in Frameworks */,
56+
EA64AC7329D31296009F2F53 /* Segment in Frameworks */,
57+
EA64AC7529D3129A009F2F53 /* SegmentAppsFlyer in Frameworks */,
5858
);
5959
runOnlyForDeploymentPostprocessing = 0;
6060
};
@@ -156,8 +156,8 @@
156156
);
157157
name = BasicExample;
158158
packageProductDependencies = (
159-
46EDC72027C6B92C00B870D7 /* Segment */,
160-
465ACC5E27D01A510025BD02 /* SegmentAppsFlyer */,
159+
EA64AC7229D31296009F2F53 /* Segment */,
160+
EA64AC7429D3129A009F2F53 /* SegmentAppsFlyer */,
161161
);
162162
productName = BasicExample;
163163
productReference = 46EDC6F227C6B8D100B870D7 /* BasicExample.app */;
@@ -611,15 +611,15 @@
611611
/* End XCRemoteSwiftPackageReference section */
612612

613613
/* Begin XCSwiftPackageProductDependency section */
614-
465ACC5E27D01A510025BD02 /* SegmentAppsFlyer */ = {
615-
isa = XCSwiftPackageProductDependency;
616-
productName = SegmentAppsFlyer;
617-
};
618-
46EDC72027C6B92C00B870D7 /* Segment */ = {
614+
EA64AC7229D31296009F2F53 /* Segment */ = {
619615
isa = XCSwiftPackageProductDependency;
620616
package = 46EDC71F27C6B92C00B870D7 /* XCRemoteSwiftPackageReference "analytics-swift" */;
621617
productName = Segment;
622618
};
619+
EA64AC7429D3129A009F2F53 /* SegmentAppsFlyer */ = {
620+
isa = XCSwiftPackageProductDependency;
621+
productName = SegmentAppsFlyer;
622+
};
623623
/* End XCSwiftPackageProductDependency section */
624624
};
625625
rootObject = 46EDC6EA27C6B8D100B870D7 /* Project object */;

Example/BasicExample/BasicExample.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ let package = Package(
2222
.package(
2323
name: "Segment",
2424
url: "https://github.com/segmentio/analytics-swift.git",
25-
from: "1.1.2"
25+
from: "1.4.0"
2626
),
2727
.package(
2828
name: "AppsFlyerLib",
2929
url: "https://github.com/AppsFlyerSDK/AppsFlyerFramework",
30-
from: "6.3.2"
30+
from: "6.10.0"
3131
)
3232
],
3333
targets: [

Sources/SegmentAppsFlyer/AppsFlyerDestination.swift

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ import UIKit
3333
import Segment
3434
import AppsFlyerLib
3535

36-
@objc
36+
@objc(SEGAppsFlyerDestination)
37+
public class ObjCSegmentAppsFlyer: NSObject, ObjCDestination, ObjCDestinationShim {
38+
public func instance() -> DestinationPlugin { return AppsFlyerDestination() }
39+
}
40+
3741
public class AppsFlyerDestination: UIResponder, DestinationPlugin {
3842
public let timeline = Timeline()
3943
public let type = PluginType.destination
@@ -189,12 +193,13 @@ extension AppsFlyerDestination: AppsFlyerLibDelegate {
189193
"source": mediaSource,
190194
"name": campaign
191195
]
192-
193-
let properties: [String: Any] = [
196+
let campaignStr = (campaign.compactMap({ (key, value) -> String in
197+
return "\(key)=\(value)"
198+
}) as Array).joined(separator: ";")
199+
let properties: [String: Codable] = [
194200
"provider": "AppsFlyer",
195-
"campaign": campaign
201+
"campaign": campaignStr
196202
]
197-
198203
analytics?.track(name: "Install Attributed", properties: properties)
199204

200205
}
@@ -222,10 +227,12 @@ extension AppsFlyerDestination: AppsFlyerLibDelegate {
222227
"name": campaign,
223228
"url": referrer
224229
]
225-
226-
let properties: [String: Any] = [
230+
let campaignStr = (campaign.compactMap({ (key, value) -> String in
231+
return "\(key)=\(value)"
232+
}) as Array).joined(separator: ";")
233+
let properties: [String: Codable] = [
227234
"provider": "AppsFlyer",
228-
"campaign": campaign
235+
"campaign": campaignStr
229236
]
230237

231238
analytics?.track(name: "Deep Link Opened", properties: properties)
@@ -270,10 +277,12 @@ extension AppsFlyerDestination: DeepLinkDelegate, UIApplicationDelegate {
270277
"name": deepLinkObj.campaign ?? "",
271278
"product": deepLinkObj.deeplinkValue ?? ""
272279
]
273-
274-
let properties: [String: Any] = [
280+
let campaignStr = (campaign.compactMap({ (key, value) -> String in
281+
return "\(key)=\(value)"
282+
}) as Array).joined(separator: ";")
283+
let properties: [String: Codable] = [
275284
"provider": "AppsFlyer",
276-
"campaign": campaign
285+
"campaign": campaignStr
277286
]
278287

279288
analytics?.track(name: "Deferred Deep Link", properties: properties)
@@ -285,10 +294,12 @@ extension AppsFlyerDestination: DeepLinkDelegate, UIApplicationDelegate {
285294
"name": deepLinkObj.campaign ?? "",
286295
"product": deepLinkObj.deeplinkValue ?? ""
287296
]
288-
289-
let properties: [String: Any] = [
297+
let campaignStr = (campaign.compactMap({ (key, value) -> String in
298+
return "\(key)=\(value)"
299+
}) as Array).joined(separator: ";")
300+
let properties: [String: Codable] = [
290301
"provider": "AppsFlyer",
291-
"campaign": campaign
302+
"campaign": campaignStr
292303
]
293304

294305
analytics?.track(name: "Direct Deep Link", properties: properties)

0 commit comments

Comments
 (0)