Skip to content

Commit 014c286

Browse files
belleklaviyoab1470
andauthored
Update SPMExample and Cocoapods Example with map view (#417)
* Add map view to sample app with hardcoded geofences * WIP remove storyboard with SwiftUI views * Remove Storyboard, use SwiftUI, clean up sample app * Connect up the AppDelegate, other fixes * Remove last unused table view cells * Add temporary KlaviyoLocation podspec and update CocoapodsExample * Add start and stop buttons, show current regions * Clean up SwiftUI, refactor AppState, remove MapViewController * Cleanup MapView * Thanks XCode for the recommended upgrades + getting rid of some warnings * Swap event type * Remove duplicative KlaviyoLocation podspec * PR feedback, more SwiftUI cleanup * sample app geofencing suggestions (#445) * changed `NavigationView` to `NavigationStack` `NavigationView` is deprecated * added .ignoresSafeArea and background for toolbars. this makes the map fill is parent container. The toolbar background ensures that the buttons are visible above the map on pre-iOS-26 devices * changed Close button to show an image instead of text * Changed "Stop" button to show an icon instead of text this resolves an issue on iOS 26 where the "Stop" button text was getting truncated * consolidated styles into `locationStatusLabel` tuple * minor formatting fix * added `geofenceMonitoringLabel` and revised geofence monitoring indicator style this fixes an issue on iOS 26+ where the monitoring label was getting truncated * removed geofencing monitoring label from bottom toolbar and placed it in navigation bar * moved all controls into a menu button at the top of the screen * moved monitoring buttons to bottom bar --------- Co-authored-by: Belle Lim <[email protected]> * Replace straggler NavigationView --------- Co-authored-by: Andrew Balmer <[email protected]>
1 parent b5d674c commit 014c286

File tree

60 files changed

+1458
-1136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1458
-1136
lines changed

Examples/KlaviyoSwiftExamples/CocoapodsExample/CocoapodsExample.xcodeproj/project.pbxproj

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
7CC1C7A828D7492C0073197F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1C79C28D7492C0073197F /* ViewController.swift */; };
2222
7CC1C7A928D7492C0073197F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1C79D28D7492C0073197F /* AppDelegate.swift */; };
2323
7CC1C7AB28D7492C0073197F /* MenuPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1C79F28D7492C0073197F /* MenuPageViewController.swift */; };
24-
7CC1C7AC28D7492C0073197F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7CC1C7A028D7492C0073197F /* Main.storyboard */; };
24+
7CC1C7AC28D7492C0073197F /* CocoapodsExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1C7A028D7492C0073197F /* CocoapodsExampleApp.swift */; };
25+
7CC1C7B528D7492C0073197F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1C7B028D7492C0073197F /* ContentView.swift */; };
26+
7CC1C7B628D7492C0073197F /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1C7B128D7492C0073197F /* LoginView.swift */; };
27+
7CC1C7B728D7492C0073197F /* MenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1C7B228D7492C0073197F /* MenuView.swift */; };
28+
7CC1C7B828D7492C0073197F /* MapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1C7B328D7492C0073197F /* MapView.swift */; };
29+
7CC1C7B928D7492C0073197F /* CheckoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC1C7B428D7492C0073197F /* CheckoutView.swift */; };
2530
AFE72889800741191D32F862 /* Pods_CocoapodsExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9F3B7C999EC91D8C05B1FEA /* Pods_CocoapodsExample.framework */; };
2631
FD1A5DA5B5F2CFD51DB4DF15 /* Pods_NotificationServiceExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 750E7E2D22F7060008D59247 /* Pods_NotificationServiceExtension.framework */; };
2732
/* End PBXBuildFile section */
@@ -86,7 +91,12 @@
8691
7CC1C79C28D7492C0073197F /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ViewController.swift; path = ../../Shared/ViewController.swift; sourceTree = "<group>"; };
8792
7CC1C79D28D7492C0073197F /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = ../../Shared/AppDelegate.swift; sourceTree = "<group>"; };
8893
7CC1C79F28D7492C0073197F /* MenuPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MenuPageViewController.swift; path = ../../Shared/MenuPageViewController.swift; sourceTree = "<group>"; };
89-
7CC1C7A028D7492C0073197F /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = ../../Shared/Main.storyboard; sourceTree = "<group>"; };
94+
7CC1C7A028D7492C0073197F /* CocoapodsExampleApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CocoapodsExampleApp.swift; path = CocoapodsExample/CocoapodsExampleApp.swift; sourceTree = "<group>"; };
95+
7CC1C7B028D7492C0073197F /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ContentView.swift; path = ../../Shared/ContentView.swift; sourceTree = "<group>"; };
96+
7CC1C7B128D7492C0073197F /* LoginView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LoginView.swift; path = ../../Shared/LoginView.swift; sourceTree = "<group>"; };
97+
7CC1C7B228D7492C0073197F /* MenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MenuView.swift; path = ../../Shared/MenuView.swift; sourceTree = "<group>"; };
98+
7CC1C7B328D7492C0073197F /* MapView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MapView.swift; path = ../../Shared/MapView.swift; sourceTree = "<group>"; };
99+
7CC1C7B428D7492C0073197F /* CheckoutView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CheckoutView.swift; path = ../../Shared/CheckoutView.swift; sourceTree = "<group>"; };
90100
7CC1C7AF28D749B70073197F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../../Shared/Info.plist; sourceTree = "<group>"; };
91101
7CC1C7B128D74C660073197F /* CocoapodsExample */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CocoapodsExample; sourceTree = "<group>"; };
92102
B9F3B7C999EC91D8C05B1FEA /* Pods_CocoapodsExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CocoapodsExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -163,7 +173,12 @@
163173
7CC1C79A28D7492C0073197F /* CheckOutTableViewCell.swift */,
164174
7CC1C79628D7492C0073197F /* CheckOutViewController.swift */,
165175
7CC1C79B28D7492C0073197F /* Images.xcassets */,
166-
7CC1C7A028D7492C0073197F /* Main.storyboard */,
176+
7CC1C7A028D7492C0073197F /* CocoapodsExampleApp.swift */,
177+
7CC1C7B028D7492C0073197F /* ContentView.swift */,
178+
7CC1C7B128D7492C0073197F /* LoginView.swift */,
179+
7CC1C7B228D7492C0073197F /* MenuView.swift */,
180+
7CC1C7B328D7492C0073197F /* MapView.swift */,
181+
7CC1C7B428D7492C0073197F /* CheckoutView.swift */,
167182
7CC1C79928D7492C0073197F /* MenuItem.swift */,
168183
7CC1C79528D7492C0073197F /* MenuItemTableViewCell.swift */,
169184
7CC1C79F28D7492C0073197F /* MenuPageViewController.swift */,
@@ -314,7 +329,6 @@
314329
isa = PBXResourcesBuildPhase;
315330
buildActionMask = 2147483647;
316331
files = (
317-
7CC1C7AC28D7492C0073197F /* Main.storyboard in Resources */,
318332
7CC1C7A728D7492C0073197F /* Images.xcassets in Resources */,
319333
);
320334
runOnlyForDeploymentPostprocessing = 0;
@@ -416,6 +430,12 @@
416430
7CC1C7A428D7492C0073197F /* Cart.swift in Sources */,
417431
7CC1C7A528D7492C0073197F /* MenuItem.swift in Sources */,
418432
7CC1C7AB28D7492C0073197F /* MenuPageViewController.swift in Sources */,
433+
7CC1C7AC28D7492C0073197F /* CocoapodsExampleApp.swift in Sources */,
434+
7CC1C7B528D7492C0073197F /* ContentView.swift in Sources */,
435+
7CC1C7B628D7492C0073197F /* LoginView.swift in Sources */,
436+
7CC1C7B728D7492C0073197F /* MenuView.swift in Sources */,
437+
7CC1C7B828D7492C0073197F /* MapView.swift in Sources */,
438+
7CC1C7B928D7492C0073197F /* CheckoutView.swift in Sources */,
419439
);
420440
runOnlyForDeploymentPostprocessing = 0;
421441
};
@@ -618,7 +638,6 @@
618638
buildSettings = {
619639
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
620640
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
621-
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
622641
CLANG_ENABLE_MODULES = YES;
623642
CODE_SIGN_ENTITLEMENTS = CocoapodsExample/CocoapodsExample.entitlements;
624643
CODE_SIGN_STYLE = Automatic;
@@ -627,8 +646,7 @@
627646
GENERATE_INFOPLIST_FILE = YES;
628647
INFOPLIST_FILE = CocoapodsExample/Info.plist;
629648
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
630-
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
631-
INFOPLIST_KEY_UIMainStoryboardFile = Main;
649+
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
632650
INFOPLIST_KEY_UIRequiredDeviceCapabilities = armv7;
633651
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft";
634652
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
@@ -654,7 +672,6 @@
654672
buildSettings = {
655673
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
656674
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
657-
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
658675
CLANG_ENABLE_MODULES = YES;
659676
CODE_SIGN_ENTITLEMENTS = CocoapodsExample/CocoapodsExample.entitlements;
660677
CODE_SIGN_STYLE = Automatic;
@@ -663,8 +680,7 @@
663680
GENERATE_INFOPLIST_FILE = YES;
664681
INFOPLIST_FILE = CocoapodsExample/Info.plist;
665682
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
666-
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
667-
INFOPLIST_KEY_UIMainStoryboardFile = Main;
683+
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
668684
INFOPLIST_KEY_UIRequiredDeviceCapabilities = armv7;
669685
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft";
670686
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import KlaviyoSwift
2+
import SwiftUI
3+
4+
@main
5+
struct CocoapodsExampleApp: App {
6+
@StateObject private var appState = AppState()
7+
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
8+
9+
var body: some Scene {
10+
WindowGroup {
11+
ContentView()
12+
.environmentObject(appState)
13+
}
14+
}
15+
}

Examples/KlaviyoSwiftExamples/CocoapodsExample/CocoapodsExample/Info.plist

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,52 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>klaviyo_app_group</key>
6-
<string>group.$(PRODUCT_BUNDLE_IDENTIFIER).shared</string>
5+
<key>CFBundleIdentifier</key>
6+
<string>com.klaviyo.CocoapodsExample</string>
77
<key>CFBundleSignature</key>
88
<string>????</string>
9+
<key>UILaunchScreen</key>
10+
<dict>
11+
<key>UIColorName</key>
12+
<string></string>
13+
<key>UIImageName</key>
14+
<string></string>
15+
</dict>
16+
<key>UIRequiredDeviceCapabilities</key>
17+
<array>
18+
<string>arm64</string>
19+
</array>
20+
<key>klaviyo_app_group</key>
21+
<string>group.$(PRODUCT_BUNDLE_IDENTIFIER).shared</string>
22+
<key>CFBundleURLTypes</key>
23+
<array>
24+
<dict>
25+
<key>CFBundleTypeRole</key>
26+
<string>Editor</string>
27+
<key>CFBundleURLName</key>
28+
<string>com.klaviyo.deeplink</string>
29+
<key>CFBundleURLSchemes</key>
30+
<array>
31+
<string>klaviyo</string>
32+
</array>
33+
</dict>
34+
</array>
35+
<key>LSApplicationQueriesSchemes</key>
36+
<array>
37+
<string>klaviyo</string>
38+
</array>
39+
<key>UIBackgroundModes</key>
40+
<array>
41+
<string>remote-notification</string>
42+
<string>location</string>
43+
</array>
44+
<key>NSLocationWhenInUseUsageDescription</key>
45+
<string>This app needs location access to show your current location on the delivery map and help you find nearby delivery zones.</string>
46+
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
47+
<string>This app needs location access to monitor geofences and provide location-based notifications even when the app is in the background.</string>
48+
<key>UIStatusBarHidden</key>
49+
<false/>
50+
<key>UIViewControllerBasedStatusBarAppearance</key>
51+
<true/>
952
</dict>
1053
</plist>

Examples/KlaviyoSwiftExamples/CocoapodsExample/Podfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use_frameworks!
44
target 'CocoapodsExample' do
55
pod 'KlaviyoSwift', '4.2.0'
66
pod 'KlaviyoForms', '4.2.0'
7+
pod 'KlaviyoLocation', :path => '../../../'
78
end
89

910
target 'NotificationServiceExtension' do

Examples/KlaviyoSwiftExamples/CocoapodsExample/Podfile.lock

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)