Skip to content

Commit

Permalink
Require iOS 17 and migrate from ObservableObject to @observable
Browse files Browse the repository at this point in the history
* Minimum iOS deployment: 17.0
* Migrating from the Observable Object protocol to the Observable macro
  * https://developer.apple.com/documentation/swiftui/migrating-from-the-observable-object-protocol-to-the-observable-macro
  • Loading branch information
cartland committed Sep 11, 2024
1 parent 09a7dd1 commit ba73990
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
18 changes: 15 additions & 3 deletions Fruitties/iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
};
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; };
058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; };
Expand All @@ -13,6 +14,7 @@
2E8773622BCD904A00BF7C40 /* StateHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E8773612BCD904A00BF7C40 /* StateHelper.swift */; };
7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
7555FFB4242A642300829871 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
Expand All @@ -25,6 +27,7 @@
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
Expand All @@ -35,6 +38,7 @@
7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
7555FF78242A565900829871 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
Expand All @@ -44,6 +48,7 @@
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
058557D7273AAEEB004C7B11 /* Preview Content */ = {
isa = PBXGroup;
Expand Down Expand Up @@ -92,6 +97,7 @@
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
7555FF7A242A565900829871 /* iosApp */ = {
isa = PBXNativeTarget;
Expand All @@ -113,6 +119,7 @@
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
7555FF73242A565900829871 /* Project object */ = {
isa = PBXProject;
Expand Down Expand Up @@ -143,6 +150,7 @@
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
7555FF79242A565900829871 /* Resources */ = {
isa = PBXResourcesBuildPhase;
Expand All @@ -154,6 +162,7 @@
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
7555FFB5242A651A00829871 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -173,6 +182,7 @@
shellScript = "cd \"$SRCROOT/..\"\n./gradlew :shared:embedAndSignAppleFrameworkForXcode\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
7555FF77242A565900829871 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand All @@ -186,6 +196,7 @@
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
7555FFA3242A565B00829871 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down Expand Up @@ -315,7 +326,7 @@
"$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
);
INFOPLIST_FILE = iosApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -344,7 +355,7 @@
"$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
);
INFOPLIST_FILE = iosApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -362,6 +373,7 @@
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = {
isa = XCConfigurationList;
Expand All @@ -384,4 +396,4 @@
/* End XCConfigurationList section */
};
rootObject = 7555FF73242A565900829871 /* Project object */;
}
}
6 changes: 2 additions & 4 deletions Fruitties/iosApp/iosApp/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import shared
import Foundation

struct ContentView: View {
@ObservedObject var uiModel: UIModel
var uiModel: UIModel
init(mainViewModel: MainViewModel) {
self.uiModel = UIModel(mainViewModel: mainViewModel)
}
Expand Down Expand Up @@ -66,14 +66,12 @@ struct FruittieView: View {
}
}

class UIModel: ObservableObject {
@Observable class UIModel {
let mainViewModel: MainViewModel
init(mainViewModel: MainViewModel) {
self.mainViewModel = mainViewModel
}
@Published
private(set) var fruitties: [Fruittie] = []
@Published
private(set) var cartDetails: [CartItemDetails] = []

@MainActor
Expand Down

0 comments on commit ba73990

Please sign in to comment.