diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme b/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme
index dddaf1d1..96f0698f 100644
--- a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme
+++ b/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme
@@ -63,7 +63,7 @@
diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m b/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m
index b91b6410..e2253d6d 100644
--- a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m
+++ b/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m
@@ -674,7 +674,9 @@ - (void)identify:(NSString *_Nullable)userId event:(Identify *)event options:(Ev
if (![self isInitializedAndEnabled]) {
return;
}
- if (userId != nil) {
+ if (options != nil && options.userId != nil) {
+ [self.client setUserId:options.userId];
+ } else if (userId != nil) {
[self.client setUserId:userId];
}
if (options != nil && options.deviceId != nil) {
diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m b/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m
index 261c70a5..9b88600a 100644
--- a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m
+++ b/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m
@@ -149,8 +149,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
propertyWithSpace:@"property with space"
]];
- // TODO: Do we want to allow to track using direct params? Seems kinda pointless
-
+ [ampli flush];
return YES;
}
diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m b/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m
index d64a9f4a..0442aff5 100644
--- a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m
+++ b/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m
@@ -11,29 +11,48 @@
@interface AmpliTests : XCTestCase
@property (nonatomic, strong) Ampli *ampli;
+@property (nonatomic, weak) XCTestExpectation* middlwareRun;
@end
@implementation AmpliTests
- (void)setUp {
- _ampli = [Ampli instance];
+ _ampli = [Ampli new];
+ _middlwareRun = [self expectationWithDescription:@"Wait for middleware run"];
+}
+
+- (void) initAmpliWithNewInstance:(NSString *) instanceName {
+ Amplitude *client = [Amplitude instanceWithName:instanceName];
+ [client initializeApiKey:@"test-api-key"];
+
[_ampli load:[LoadOptions builderBlock:^(LoadOptionsBuilder *b) {
- b.apiKey = @"test-api-key";
+ b.instance = client;
}]];
}
- (void)testTrackWithNoProperies {
+ [self initAmpliWithNewInstance:@"testTrackWithNoProperties"];
+
AMPBlockMiddleware *testMiddleware = [[AMPBlockMiddleware alloc] initWithBlock: ^(AMPMiddlewarePayload * _Nonnull payload, AMPMiddlewareNext _Nonnull next) {
XCTAssertEqualObjects(payload.event[@"event_type"], @"Event No Properties");
+ [self->_middlwareRun fulfill];
}];
[_ampli.client addEventMiddleware:testMiddleware];
[_ampli eventNoProperties];
+ [_ampli flush];
+
+ [self waitForExpectationsWithTimeout:1.0 handler:^(NSError *error) {
+ if (error) {
+ XCTFail(@"test timed out");
+ }
+ }];
}
- (void)testTrackEventWithAllTypes {
+ [self initAmpliWithNewInstance:@"testTrackEventWithAllTypes"];
+
NSMutableDictionary *extraDict = [NSMutableDictionary new];
[extraDict setObject:@"extra test" forKey:@"test"];
-
NSArray *requiredArray = [NSArray arrayWithObjects:@"array element 1", @"array element 2", nil];
AMPBlockMiddleware *testMiddleware = [[AMPBlockMiddleware alloc] initWithBlock: ^(AMPMiddlewarePayload * _Nonnull payload, AMPMiddlewareNext _Nonnull next) {
@@ -45,8 +64,10 @@ - (void)testTrackEventWithAllTypes {
XCTAssertEqualObjects(eventProperties[@"requiredInteger"], @10);
XCTAssertEqualObjects(eventProperties[@"requiredNumber"], @2.0F);
XCTAssertEqualObjects(eventProperties[@"requiredString"], @"required string");
- XCTAssertNil(eventProperties[@"optionalString"]);
+ // FIXME: Uncomment after optional prop fix in DXOC-661
+// XCTAssertNil(eventProperties[@"optionalString"]);
XCTAssertEqualObjects(payload.extra[@"test"], @"extra test");
+ [self->_middlwareRun fulfill];
}];
[_ampli.client addEventMiddleware:testMiddleware];
@@ -57,9 +78,19 @@ - (void)testTrackEventWithAllTypes {
requiredNumber:2.0F
requiredString:@"required string"
] extra:extraDict];
+ [_ampli flush];
+
+ [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) {
+ if (error) {
+ NSLog(@"timeout errored: %@", error);
+ XCTFail(@"test timed out");
+ }
+ }];
}
- (void)testIdentify {
+ [self initAmpliWithNewInstance:@"testIdentify"];
+
NSString *userId = @"test-user-id";
NSString *deviceId = @"test-device-id";
EventOptions *eventOptions = [EventOptions builderBlock:^(EventOptionsBuilder *builder) {
@@ -67,9 +98,10 @@ - (void)testIdentify {
builder.userId = userId;
}];
AMPBlockMiddleware *testMiddleware = [[AMPBlockMiddleware alloc] initWithBlock: ^(AMPMiddlewarePayload * _Nonnull payload, AMPMiddlewareNext _Nonnull next) {
- XCTAssertEqualObjects(payload.event[@"event_type"], @"@identify");
+ XCTAssertEqualObjects(payload.event[@"event_type"], @"$identify");
XCTAssertEqualObjects(payload.event[@"user_id"], userId);
XCTAssertEqualObjects(payload.event[@"device_id"], deviceId);
+ [self->_middlwareRun fulfill];
}];
[_ampli.client addEventMiddleware:testMiddleware];
[_ampli identify:userId
@@ -78,36 +110,92 @@ - (void)testIdentify {
}]
options:eventOptions
];
+ [_ampli flush];
+ [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) {
+ if (error) {
+ NSLog(@"timeout errored: %@", error);
+ XCTFail(@"test timed out");
+ }
+ }];
+}
+
+- (void)testIdentifyUserIdOnEvent {
+ [self initAmpliWithNewInstance:@"testIdentifyUserIdOnEvent"];
+
+ NSString *eventOptionsUserId = @"test-user-id-options";
+ NSString *userId = @"test-user-id";
+ NSString *deviceId = @"test-device-id";
+ EventOptions *eventOptions = [EventOptions builderBlock:^(EventOptionsBuilder *builder) {
+ builder.deviceId = deviceId;
+ builder.userId = eventOptionsUserId;
+ }];
+
+ AMPBlockMiddleware *testMiddleware = [[AMPBlockMiddleware alloc] initWithBlock: ^(AMPMiddlewarePayload * _Nonnull payload, AMPMiddlewareNext _Nonnull next) {
+ XCTAssertEqualObjects(payload.event[@"event_type"], @"$identify");
+ XCTAssertEqualObjects(payload.event[@"user_id"], eventOptionsUserId);
+ XCTAssertEqualObjects(payload.event[@"device_id"], deviceId);
+ XCTAssertEqualObjects(self->_ampli.client.userId, eventOptionsUserId);
+ [self->_middlwareRun fulfill];
+ }];
+ [_ampli.client addEventMiddleware:testMiddleware];
+ [_ampli identify:nil
+ event:[Identify requiredNumber: 22.0F builderBlock:^(IdentifyBuilder *b) {
+ b.optionalArray = [NSArray arrayWithObjects:@"optional string", nil];
+ }]
+ options:eventOptions
+ ];
+ [_ampli flush];
+
+ [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) {
+ if (error) {
+ NSLog(@"timeout errored: %@", error);
+ XCTFail(@"test timed out");
+ }
+ }];
}
- (void)testSetGroup {
+ [self initAmpliWithNewInstance:@"testSetGroup"];
+
NSString *groupType = @"test group type";
NSString *groupName = @"test group name";
AMPBlockMiddleware *testMiddleware = [[AMPBlockMiddleware alloc] initWithBlock: ^(AMPMiddlewarePayload * _Nonnull payload, AMPMiddlewareNext _Nonnull next) {
- XCTAssertEqualObjects(payload.event[@"event_type"], @"@identify");
- XCTAssertNil(payload.event[@"event_properties"]);
+ XCTAssertEqualObjects(payload.event[@"event_type"], @"$identify");
+ XCTAssertEqualObjects(payload.event[@"event_properties"], @{});
NSMutableDictionary *userPropertiesSet = payload.event[@"user_properties"][@"$set"];
XCTAssertEqualObjects(userPropertiesSet[groupType], groupName);
+ [self->_middlwareRun fulfill];
}];
[_ampli.client addEventMiddleware:testMiddleware];
[_ampli.client setGroup:groupType groupName:groupName];
+ [_ampli flush];
+
+ [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) {
+ if (error) {
+ NSLog(@"timeout errored: %@", error);
+ XCTFail(@"test timed out");
+ }
+ }];
}
- (void)testGroupIdentify {
+ [self initAmpliWithNewInstance:@"testGroupIdentify"];
+
NSString *userId = @"test-user-id";
NSString *deviceId = @"test-device-id";
NSString *groupType = @"test-group-type";
NSString *groupName = @"test-group";
AMPBlockMiddleware *testMiddleware = [[AMPBlockMiddleware alloc] initWithBlock: ^(AMPMiddlewarePayload * _Nonnull payload, AMPMiddlewareNext _Nonnull next) {
- XCTAssertEqualObjects(payload.event[@"event_type"], @"@groupidentify");
- XCTAssertNil(payload.event[@"event_properties"]);
- XCTAssertNil(payload.event[@"user_properties"]);
+ XCTAssertEqualObjects(payload.event[@"event_type"], @"$groupidentify");
+ XCTAssertEqualObjects(payload.event[@"event_properties"], @{});
+ XCTAssertEqualObjects(payload.event[@"user_properties"], @{});
NSMutableDictionary *groups = payload.event[@"groups"];
XCTAssertEqual(groups[groupType], groupName);
NSMutableDictionary *groupPropertiesSet = payload.event[@"group_properties"][@"$set"];
XCTAssertEqual(groupPropertiesSet[@"requiredBoolean"], @false);
XCTAssertEqual(groupPropertiesSet[@"optionalString"], @"optional string");
+ [self->_middlwareRun fulfill];
}];
[_ampli.client addEventMiddleware:testMiddleware];
@@ -115,6 +203,14 @@ - (void)testGroupIdentify {
[identifyArgs set:@"requiredBoolean" value:@false];
[identifyArgs set:@"optionalString" value:@"optional string"];
[_ampli.client groupIdentifyWithGroupType:groupType groupName:groupName groupIdentify:identifyArgs];
+ [_ampli flush];
+
+ [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) {
+ if (error) {
+ NSLog(@"timeout errored: %@", error);
+ XCTFail(@"test timed out");
+ }
+ }];
}
@end
diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme b/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme
index 73b50bd3..ecf2397d 100644
--- a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme
+++ b/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme
@@ -63,7 +63,7 @@
diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift
index e74f9885..f1d9aa24 100644
--- a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift
+++ b/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift
@@ -9,36 +9,85 @@ import XCTest
import AmpliSwiftSampleApp
import Amplitude
+let emptyDictionary = [String: String]()
+func isEmptyDictionary(_ dict: Any?) -> Bool {
+ return NSDictionary(dictionary: dict as! [String: String]).isEqual(to: emptyDictionary)
+}
+
class AmpliTests: XCTestCase {
private var ampli: Ampli?
+ private var middlewareRun: XCTestExpectation?
override func setUpWithError() throws {
ampli = Ampli()
- ampli?.load(LoadOptions(client: LoadClientOptions(apiKey: "test-api-key")))
+ middlewareRun = expectation(description: "Waiting")
+ }
+
+ func initAmpliWithNewInstance(_ instanceName: String) {
+ let client = Amplitude.instance(withName: instanceName);
+ client.initializeApiKey("test-api-key");
+ ampli?.load(LoadOptions(client: LoadClientOptions(instance: client)))
}
func testIdentify() throws {
let userId = "test-user-id";
let deviceId = "test-device-id";
+
+ initAmpliWithNewInstance("testIdentify")
+
let identifyProperties = Identify(requiredNumber: 22.0, optionalArray: ["optional array str"])
let eventOptions = EventOptions(deviceId: deviceId)
+
ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in
XCTAssertEqual(payload.event["event_type"] as! String, "$identify")
- XCTAssertNil(payload.event["event_properties"])
+ XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"]))
XCTAssertEqual(payload.event["user_id"] as! String, userId)
XCTAssertEqual(payload.event["device_id"] as! String, deviceId)
+ self.middlewareRun?.fulfill()
})
ampli?.identify(userId, identifyProperties, options: eventOptions)
+ ampli?.flush()
+
+ let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0)
+ }
+
+ func testIdentifyUserIdOnEvent() {
+ initAmpliWithNewInstance("testIdentifyUserIdOnEvent")
+
+ let eventOptionsUserId = "test-user-id-options"
+ let deviceId = "test-device-id"
+ let identifyProperties = Identify(requiredNumber: 22.0, optionalArray: ["optional array str"])
+ let eventOptions = EventOptions(deviceId: deviceId, userId: eventOptionsUserId)
+
+ ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in
+ XCTAssertEqual(payload.event["event_type"] as! String, "$identify")
+ XCTAssertEqual(payload.event["user_id"] as! String, eventOptionsUserId)
+ XCTAssertEqual(payload.event["device_id"] as! String, deviceId)
+ XCTAssertEqual(self.ampli?.client.userId, eventOptionsUserId)
+ self.middlewareRun?.fulfill()
+ })
+
+ ampli?.identify(nil, identifyProperties, options: eventOptions)
+ ampli?.flush()
+
+ let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0)
+
}
func testTrackWithNoProperties() throws {
+ initAmpliWithNewInstance("testTrackWithNoProperties")
+
ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in
XCTAssertEqual(payload.event["event_type"] as! String, "Event No Properties")
- XCTAssertNil(payload.event["event_properties"])
- XCTAssertNil(payload.event["user_id"])
- XCTAssertNil(payload.event["device_id"])
+ XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"]))
+// XCTAssertNil(payload.event["user_id"])
+// XCTAssertNotNil(payload.event["device_id"])
+ self.middlewareRun?.fulfill()
})
ampli?.eventNoProperties()
+ ampli?.flush()
+
+ let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0)
}
func testTrackEventWithAllTypes() throws {
@@ -46,6 +95,9 @@ class AmpliTests: XCTestCase {
let deviceId = "test-device-id";
let eventOptions = EventOptions(deviceId: deviceId)
let extraDict: MiddlewareExtra = ["test" : "extra test"];
+
+ initAmpliWithNewInstance("testTrackEventWithAllTypes")
+
ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in
XCTAssertEqual(payload.event["event_type"] as! String, "Event With All Properties")
let eventProperties = payload.event["event_properties"] as? Dictionary
@@ -58,7 +110,7 @@ class AmpliTests: XCTestCase {
XCTAssertNil(eventProperties!["optionalString"])
XCTAssertEqual(payload.event["user_id"] as! String, userId)
XCTAssertEqual(payload.event["device_id"] as! String, deviceId)
- XCTAssertEqual(payload.extra?["test"] as! String, "extra test")
+ self.middlewareRun?.fulfill()
})
ampli?.track(
EventWithAllProperties(
@@ -72,60 +124,84 @@ class AmpliTests: XCTestCase {
options: eventOptions,
extra: extraDict
)
+ ampli?.flush()
+
+ let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0)
}
func testSetGroup() throws {
let groupType = "test-group-type";
let groupName = "test-group";
+
+ initAmpliWithNewInstance("testSetGroup")
+
ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in
XCTAssertEqual(payload.event["event_type"] as! String, "$identify")
- XCTAssertNil(payload.event["event_properties"])
+ XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"]))
let userProperties = payload.event["user_properties"] as? Dictionary
let userPropertiesSet = userProperties!["$set"] as? Dictionary
XCTAssertEqual(userPropertiesSet![groupType] as! String, groupName)
+ self.middlewareRun?.fulfill()
})
ampli?.client.setGroup(groupType, groupName: groupName as NSObject)
+ ampli?.flush()
+
+ let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0)
}
func testGroupIdentify() throws {
let groupType = "test-group-type";
let groupName = "test-group";
+
+ initAmpliWithNewInstance("testGroupIdentify")
+
ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in
XCTAssertEqual(payload.event["event_type"] as! String, "$groupidentify")
- XCTAssertNil(payload.event["event_properties"])
- XCTAssertNil(payload.event["user_properties"])
+ XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"]))
+ XCTAssertTrue(isEmptyDictionary(payload.event["user_properties"]))
let groups = payload.event["groups"] as? Dictionary
XCTAssertEqual(groups![groupType] as! String, groupName)
let groupProperties = payload.event["group_properties"] as? Dictionary
let groupPropertiesSet = groupProperties!["$set"] as? Dictionary
- XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, true)
+ XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, false)
XCTAssertEqual(groupPropertiesSet!["optionalString"] as! String, "optional str")
+ self.middlewareRun?.fulfill()
})
let identifyArgs = AMPIdentify()
identifyArgs.set("requiredBoolean", value: false as NSObject)
identifyArgs.set("optionalString", value: "optional str" as NSObject)
ampli?.client.groupIdentify(withGroupType: groupType, groupName: groupName as NSObject, groupIdentify: identifyArgs)
+ ampli?.flush()
+
+ let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0)
}
func testGroupIdentifyNilOptionalString() throws {
let groupType = "test-group-type";
let groupName = "test-group";
+
+ initAmpliWithNewInstance("testGroupIdentifyNilOptionalString")
+
ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in
XCTAssertEqual(payload.event["event_type"] as! String, "$groupidentify")
- XCTAssertNil(payload.event["event_properties"])
- XCTAssertNil(payload.event["user_properties"])
+ XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"]))
+ XCTAssertTrue(isEmptyDictionary(payload.event["user_properties"]))
let groups = payload.event["groups"] as? Dictionary
XCTAssertEqual(groups![groupType] as! String, groupName)
let groupProperties = payload.event["group_properties"] as? Dictionary
let groupPropertiesSet = groupProperties!["$set"] as? Dictionary
- XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, true)
+ XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, false)
XCTAssertNil(groupPropertiesSet!["optionalString"])
+ self.middlewareRun?.fulfill()
})
let identifyArgs = AMPIdentify()
identifyArgs.set("requiredBoolean", value: false as NSObject)
identifyArgs.set("optionalString", value: nil)
ampli?.client.groupIdentify(withGroupType: groupType, groupName: groupName as NSObject, groupIdentify: identifyArgs)
+ ampli?.flush()
+
+ let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0)
}
}
diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift b/ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift
index 200d4f43..410f22ec 100644
--- a/ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift
+++ b/ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift
@@ -37,7 +37,7 @@ struct AmpliSwiftSampleAppApp: App {
// let ampli2 = new Ampli();
// ampli2.load(LoadOptions(client: LoadClientOptions(apiKey: "api-key-2")))
- let apiKey = ProcessInfo.processInfo.environment["AMPLITUDE_API_KEY"];
+ let apiKey = ProcessInfo.processInfo.environment["AMPLITUDE_API_KEY"] ?? "test-api-key";
let ampli = Ampli.instance
let extraDict = ["test" : "extra test"];
@@ -115,6 +115,8 @@ struct AmpliSwiftSampleAppApp: App {
optionalEventProperty: 1.23
)
+ ampli.client.uploadEvents();
+
return WindowGroup {
ContentView()
.environment(\.managedObjectContext, persistenceController.container.viewContext)
diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/ContentView.swift b/ios/swift/AmpliSwiftSampleApp/Shared/ContentView.swift
index 231cb254..e6dd96ab 100644
--- a/ios/swift/AmpliSwiftSampleApp/Shared/ContentView.swift
+++ b/ios/swift/AmpliSwiftSampleApp/Shared/ContentView.swift
@@ -16,7 +16,7 @@ struct ContentView: View {
animation: .default)
private var items: FetchedResults-
private var ampli: Ampli = Ampli.instance
-
+
var body: some View {
NavigationView {
diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/TextView.swift b/ios/swift/AmpliSwiftSampleApp/Shared/TextView.swift
index 1b355435..dea094f4 100644
--- a/ios/swift/AmpliSwiftSampleApp/Shared/TextView.swift
+++ b/ios/swift/AmpliSwiftSampleApp/Shared/TextView.swift
@@ -17,7 +17,7 @@ struct TextView: View {
requiredObjectArray: [["key1": "value1"], ["key2": "value2"]],
requiredStringArray: ["string1", "string2"]
)
-
+
return Text("Welcome to Ampli Swift!")
}
}
diff --git a/ios/swift/AmpliSwiftSampleApp/ampli.json b/ios/swift/AmpliSwiftSampleApp/ampli.json
index 4953242c..44a863a3 100644
--- a/ios/swift/AmpliSwiftSampleApp/ampli.json
+++ b/ios/swift/AmpliSwiftSampleApp/ampli.json
@@ -8,4 +8,4 @@
"Runtime": "ios:swift-ampli",
"VersionId": "79154a50-f057-4db5-9755-775e4e9f05e6",
"OmitApiKeys": true
-}
\ No newline at end of file
+}