Skip to content

Commit 06bd9d4

Browse files
authored
Merge pull request #2 from nativeapptemplate/version_up_swift_to_6
update to Swift 6
2 parents 2ee546b + a87abf5 commit 06bd9d4

File tree

17 files changed

+59
-79
lines changed

17 files changed

+59
-79
lines changed

NativeAppTemplate.xcodeproj/project.pbxproj

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,8 @@
866866
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
867867
SWIFT_EMIT_LOC_STRINGS = YES;
868868
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
869+
SWIFT_STRICT_CONCURRENCY = complete;
870+
SWIFT_VERSION = 6.0;
869871
};
870872
name = Debug;
871873
};
@@ -925,6 +927,8 @@
925927
SWIFT_COMPILATION_MODE = wholemodule;
926928
SWIFT_EMIT_LOC_STRINGS = YES;
927929
SWIFT_OPTIMIZATION_LEVEL = "-O";
930+
SWIFT_STRICT_CONCURRENCY = complete;
931+
SWIFT_VERSION = 6.0;
928932
VALIDATE_PRODUCT = YES;
929933
};
930934
name = Release;
@@ -937,7 +941,7 @@
937941
BUNDLE_ID_SUFFIX = .dev;
938942
CODE_SIGN_ENTITLEMENTS = NativeAppTemplate/NativeAppTemplate.entitlements;
939943
CODE_SIGN_STYLE = Automatic;
940-
CURRENT_PROJECT_VERSION = 1;
944+
CURRENT_PROJECT_VERSION = 2;
941945
DEVELOPMENT_ASSET_PATHS = "\"NativeAppTemplate/Preview Content\"";
942946
DEVELOPMENT_TEAM = NNYDL5U3V3;
943947
ENABLE_PREVIEWS = YES;
@@ -950,15 +954,15 @@
950954
"$(inherited)",
951955
"@executable_path/Frameworks",
952956
);
953-
MARKETING_VERSION = 1.0.0;
957+
MARKETING_VERSION = 1.0.1;
954958
PRODUCT_BUNDLE_IDENTIFIER = "com.nativeapptemplate.NativeAppTemplate.ios$(BUNDLE_ID_SUFFIX)";
955959
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = com.nativeapptemplate.NativeAppTemplateFree.ios;
956960
PRODUCT_NAME = NativeAppTemplate;
957961
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
958962
SUPPORTS_MACCATALYST = NO;
959963
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
960964
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
961-
SWIFT_VERSION = 5.0;
965+
SWIFT_VERSION = 6.0;
962966
TARGETED_DEVICE_FAMILY = "1,2";
963967
};
964968
name = Debug;
@@ -971,7 +975,7 @@
971975
BUNDLE_ID_SUFFIX = "";
972976
CODE_SIGN_ENTITLEMENTS = NativeAppTemplate/NativeAppTemplate.entitlements;
973977
CODE_SIGN_STYLE = Automatic;
974-
CURRENT_PROJECT_VERSION = 1;
978+
CURRENT_PROJECT_VERSION = 2;
975979
DEVELOPMENT_ASSET_PATHS = "\"NativeAppTemplate/Preview Content\"";
976980
DEVELOPMENT_TEAM = NNYDL5U3V3;
977981
ENABLE_PREVIEWS = YES;
@@ -984,15 +988,15 @@
984988
"$(inherited)",
985989
"@executable_path/Frameworks",
986990
);
987-
MARKETING_VERSION = 1.0.0;
991+
MARKETING_VERSION = 1.0.1;
988992
PRODUCT_BUNDLE_IDENTIFIER = "com.nativeapptemplate.NativeAppTemplate.ios$(BUNDLE_ID_SUFFIX)";
989993
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = com.nativeapptemplate.NativeAppTemplateFree.ios;
990994
PRODUCT_NAME = NativeAppTemplate;
991995
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
992996
SUPPORTS_MACCATALYST = NO;
993997
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
994998
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
995-
SWIFT_VERSION = 5.0;
999+
SWIFT_VERSION = 6.0;
9961000
TARGETED_DEVICE_FAMILY = "1,2";
9971001
};
9981002
name = Release;
@@ -1053,6 +1057,8 @@
10531057
SWIFT_COMPILATION_MODE = wholemodule;
10541058
SWIFT_EMIT_LOC_STRINGS = YES;
10551059
SWIFT_OPTIMIZATION_LEVEL = "-O";
1060+
SWIFT_STRICT_CONCURRENCY = complete;
1061+
SWIFT_VERSION = 6.0;
10561062
VALIDATE_PRODUCT = YES;
10571063
};
10581064
name = Beta;
@@ -1065,7 +1071,7 @@
10651071
BUNDLE_ID_SUFFIX = .beta;
10661072
CODE_SIGN_ENTITLEMENTS = NativeAppTemplate/NativeAppTemplate.entitlements;
10671073
CODE_SIGN_STYLE = Automatic;
1068-
CURRENT_PROJECT_VERSION = 1;
1074+
CURRENT_PROJECT_VERSION = 2;
10691075
DEVELOPMENT_ASSET_PATHS = "\"NativeAppTemplate/Preview Content\"";
10701076
DEVELOPMENT_TEAM = NNYDL5U3V3;
10711077
ENABLE_PREVIEWS = YES;
@@ -1078,14 +1084,14 @@
10781084
"$(inherited)",
10791085
"@executable_path/Frameworks",
10801086
);
1081-
MARKETING_VERSION = 1.0.0;
1087+
MARKETING_VERSION = 1.0.1;
10821088
PRODUCT_BUNDLE_IDENTIFIER = "com.nativeapptemplate.NativeAppTemplate.ios$(BUNDLE_ID_SUFFIX)";
10831089
PRODUCT_NAME = NativeAppTemplate;
10841090
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
10851091
SUPPORTS_MACCATALYST = NO;
10861092
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
10871093
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
1088-
SWIFT_VERSION = 5.0;
1094+
SWIFT_VERSION = 6.0;
10891095
TARGETED_DEVICE_FAMILY = "1,2";
10901096
};
10911097
name = Beta;

NativeAppTemplate/App.swift

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,14 @@ struct App {
2323
private var dataManager: DataManager
2424
private var messageBus: MessageBus
2525

26-
init() {
26+
@MainActor init() {
2727
// setup objects
2828
let nativeAppTemplateObjects = App.objects
2929
loginRepository = nativeAppTemplateObjects.loginRepository
3030
sessionController = nativeAppTemplateObjects.sessionController
3131
dataManager = nativeAppTemplateObjects.dataManager
3232
messageBus = nativeAppTemplateObjects.messageBus
3333

34-
// configure ui
35-
customizeNavigationBar()
36-
customizeTableView()
37-
customizeControls()
38-
3934
try? Tips.configure()
4035
}
4136
}
@@ -62,7 +57,7 @@ extension App: SwiftUI.App {
6257
// MARK: - internal
6358
extension App {
6459
// Initialise the database
65-
static var objects: Objects {
60+
@MainActor static var objects: Objects {
6661
let loginRepository = LoginRepository()
6762
let sessionController = SessionController(loginRepository: loginRepository)
6863
let messageBus = MessageBus()
@@ -77,30 +72,3 @@ extension App {
7772
)
7873
}
7974
}
80-
81-
// MARK: - private
82-
private extension App {
83-
func customizeNavigationBar() {
84-
UINavigationBar.appearance().backgroundColor = .backgroundUiColor
85-
86-
UINavigationBar.appearance().largeTitleTextAttributes = [
87-
.foregroundColor: UIColor(named: "titleText")!,
88-
.font: UIFont.uiLargeTitle
89-
]
90-
UINavigationBar.appearance().titleTextAttributes = [
91-
.foregroundColor: UIColor(named: "titleText")!,
92-
.font: UIFont.uiHeadline
93-
]
94-
}
95-
96-
func customizeTableView() {
97-
UITableView.appearance().separatorColor = .clear
98-
UITableViewCell.appearance().backgroundColor = .backgroundUiColor
99-
UITableViewCell.appearance().selectionStyle = .none
100-
UITableView.appearance().backgroundColor = .backgroundUiColor
101-
}
102-
103-
func customizeControls() {
104-
UISwitch.appearance().onTintColor = .accent
105-
}
106-
}

NativeAppTemplate/Data/DataManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import SwiftUI
99

10-
@Observable class DataManager {
10+
@MainActor @Observable class DataManager {
1111

1212
// MARK: - Properties
1313
// Initialiser Arguments

NativeAppTemplate/Data/Repositories/AccountPasswordRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Daisuke Adachi on 2023/02/25.
66
//
77

8-
class AccountPasswordRepository {
8+
@MainActor class AccountPasswordRepository {
99
let accountPasswordService: AccountPasswordService
1010

1111
init(

NativeAppTemplate/Data/Repositories/ShopRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import SwiftUI
99

10-
@Observable class ShopRepository {
10+
@MainActor @Observable class ShopRepository {
1111
let shopsService: ShopsService
1212

1313
var shops: [Shop] = []

NativeAppTemplate/Login/LoginRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
@Observable public class LoginRepository {
10+
@MainActor @Observable public class LoginRepository {
1111
// MARK: - Properties
1212
private var _currentShopkeeper: Shopkeeper?
1313

NativeAppTemplate/Login/SignUpRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
class SignUpRepository {
10+
@MainActor class SignUpRepository {
1111
func signUp(signUp: SignUp) async throws -> Shopkeeper {
1212
var shopkeeper: Shopkeeper
1313

NativeAppTemplate/Models/Shop.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
struct Shop: Codable, Identifiable {
10+
struct Shop: Codable, Identifiable, Sendable {
1111
var id: String
1212
var name: String
1313
var description: String

NativeAppTemplate/Models/Shopkeeper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010

11-
public struct Shopkeeper: Hashable, Codable {
11+
public struct Shopkeeper: Hashable, Codable, Sendable {
1212

1313
// MARK: - Properties
1414
var id: String

NativeAppTemplate/Persistence/KeychainStore/LoggedInShopkeeper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,5 @@ public class LoggedInShopkeeper: NSObject, NSCoding, NSSecureCoding {
119119
)
120120
}
121121

122-
public static var supportsSecureCoding = true
122+
public static let supportsSecureCoding = true
123123
}

0 commit comments

Comments
 (0)