Skip to content

Commit 0c3d0ce

Browse files
authored
Update examples to use default main actor (#248)
* Default main actor isolation in examples. * wip * wip * wip * wip * wip * convert more examples * wip * Update Package.swift
1 parent 652e9ce commit 0c3d0ce

21 files changed

Lines changed: 74 additions & 77 deletions

Examples/CaseStudies/Animations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct AnimationsCaseStudy: SwiftUICaseStudy {
4747
}
4848

4949
@Table
50-
private struct Fact: Identifiable {
50+
nonisolated private struct Fact: Identifiable {
5151
let id: Int
5252
var body: String
5353
}

Examples/CaseStudies/DynamicQuery.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct DynamicQueryDemo: SwiftUICaseStudy {
100100
}
101101

102102
@Table
103-
private struct Fact: Identifiable {
103+
nonisolated private struct Fact: Identifiable {
104104
let id: Int
105105
var body: String
106106
}

Examples/CaseStudies/ObservableModelDemo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private class Model {
8787
}
8888

8989
@Table
90-
private struct Fact: Identifiable {
90+
nonisolated private struct Fact: Identifiable {
9191
let id: Int
9292
var body: String
9393
}

Examples/CaseStudies/SwiftDataTemplateDemo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct SwiftDataTemplateView: SwiftUICaseStudy {
5656
}
5757

5858
@Table
59-
private struct Item: Identifiable {
59+
nonisolated private struct Item: Identifiable {
6060
let id: Int
6161
var timestamp: Date
6262
}

Examples/CaseStudies/SwiftUIDemo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct SwiftUIDemo: SwiftUICaseStudy {
5656
}
5757

5858
@Table
59-
private struct Fact: Identifiable {
59+
nonisolated private struct Fact: Identifiable {
6060
let id: Int
6161
var body: String
6262
}

Examples/CaseStudies/TransactionDemo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct TransactionDemo: SwiftUICaseStudy {
7171
}
7272

7373
@Table
74-
private struct Fact: Identifiable {
74+
nonisolated private struct Fact: Identifiable {
7575
static let databaseTableName = "facts"
7676
let id: Int
7777
var body: String

Examples/CaseStudies/UIKitDemo.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ final class UIKitCaseStudyViewController: UICollectionViewController, UIKitCaseS
107107
}
108108
}
109109

110-
enum Section: Hashable {
110+
nonisolated enum Section: Hashable {
111111
case facts
112112
}
113113
}
114114

115115
@Table
116-
private struct Fact: Hashable, Identifiable {
116+
nonisolated private struct Fact: Hashable, Identifiable {
117117
let id: Int
118118
var body: String
119119
}

Examples/CloudKitDemo/Schema.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import OSLog
33
import SQLiteData
44

55
@Table
6-
struct Counter: Identifiable {
6+
nonisolated struct Counter: Identifiable {
77
let id: UUID
88
var count = 0
99
}

Examples/Examples.xcodeproj/project.pbxproj

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@
430430
attributes = {
431431
BuildIndependentTargetsInParallel = 1;
432432
LastSwiftUpdateCheck = 1640;
433-
LastUpgradeCheck = 1620;
433+
LastUpgradeCheck = 2610;
434434
TargetAttributes = {
435435
CA2BDD9C2E71C30B000974D3 = {
436436
CreatedOnToolsVersion = 16.4;
@@ -639,7 +639,6 @@
639639
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SQLiteData.CloudKitDemo;
640640
PRODUCT_NAME = "$(TARGET_NAME)";
641641
SWIFT_EMIT_LOC_STRINGS = YES;
642-
SWIFT_VERSION = 5.0;
643642
TARGETED_DEVICE_FAMILY = "1,2";
644643
};
645644
name = Debug;
@@ -670,7 +669,6 @@
670669
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SQLiteData.CloudKitDemo;
671670
PRODUCT_NAME = "$(TARGET_NAME)";
672671
SWIFT_EMIT_LOC_STRINGS = YES;
673-
SWIFT_VERSION = 5.0;
674672
TARGETED_DEVICE_FAMILY = "1,2";
675673
};
676674
name = Release;
@@ -801,7 +799,10 @@
801799
MTL_FAST_MATH = YES;
802800
ONLY_ACTIVE_ARCH = YES;
803801
SDKROOT = iphoneos;
802+
STRING_CATALOG_GENERATE_SYMBOLS = YES;
804803
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
804+
SWIFT_APPROACHABLE_CONCURRENCY = YES;
805+
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
805806
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
806807
SWIFT_VERSION = 6.0;
807808
};
@@ -858,7 +859,10 @@
858859
MTL_ENABLE_DEBUG_INFO = NO;
859860
MTL_FAST_MATH = YES;
860861
SDKROOT = iphoneos;
862+
STRING_CATALOG_GENERATE_SYMBOLS = YES;
863+
SWIFT_APPROACHABLE_CONCURRENCY = YES;
861864
SWIFT_COMPILATION_MODE = wholemodule;
865+
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
862866
SWIFT_VERSION = 6.0;
863867
VALIDATE_PRODUCT = YES;
864868
};

Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

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

0 commit comments

Comments
 (0)