Skip to content

Commit 3b79cd4

Browse files
authored
Feature/structured concurrency (#3)
* WIP feature/structured-concurrency * Bump minimum swift version to 5.5 for concurrency. Remove unsafe swift flag. feature/structured-concurrency * Add MainActor notations to example views. Add complete concurrency checks to example projects. feature/structured-concurrency * Finish adding MainActor notations and Sendable conformances to library types. feature/structured-concurrency * Update workflow config. feature/structured-concurrency * Remove MainActor from configuration and style types feature/structured-concurrency * Remove MainActor from BackPortedButtonToggleStyle feature/structured-concurrency
1 parent 12f7c90 commit 3b79cd4

17 files changed

+108
-17
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,20 @@ on:
1111

1212
jobs:
1313
example:
14-
runs-on: ${{ matrix.runsOn }}
15-
env:
16-
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}/Contents/Developer"
14+
runs-on: macos-12
1715
strategy:
1816
matrix:
19-
include:
20-
- xcode: "Xcode_12.5.1.app"
21-
runsOn: macOS-11
22-
- xcode: "Xcode_13.2.1.app"
23-
runsOn: macOS-12
17+
xcode:
18+
- "13.2.1"
19+
- "13.4.1"
20+
- "14.0"
2421
steps:
2522
- uses: actions/checkout@v2
23+
- name: Select Xcode ${{ matrix.xcode }}
24+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
25+
- name: Format lint
26+
run: swiftformat --lint .
27+
- name: Lint
28+
run: swiftlint .
2629
- name: Run tests
2730
run: xcodebuild -project ./Example/Example.xcodeproj -scheme Example test -destination platform='iOS Simulator',name='iPhone 11' -quiet -enableCodeCoverage YES -derivedDataPath "./output"
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1400"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "PickBetter"
18+
BuildableName = "PickBetter"
19+
BlueprintName = "PickBetter"
20+
ReferencedContainer = "container:">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
</LaunchAction>
44+
<ProfileAction
45+
buildConfiguration = "Release"
46+
shouldUseLaunchSchemeArgsEnv = "YES"
47+
savedToolIdentifier = ""
48+
useCustomWorkingDirectory = "NO"
49+
debugDocumentVersioning = "YES">
50+
<MacroExpansion>
51+
<BuildableReference
52+
BuildableIdentifier = "primary"
53+
BlueprintIdentifier = "PickBetter"
54+
BuildableName = "PickBetter"
55+
BlueprintName = "PickBetter"
56+
ReferencedContainer = "container:">
57+
</BuildableReference>
58+
</MacroExpansion>
59+
</ProfileAction>
60+
<AnalyzeAction
61+
buildConfiguration = "Debug">
62+
</AnalyzeAction>
63+
<ArchiveAction
64+
buildConfiguration = "Release"
65+
revealArchiveInOrganizer = "YES">
66+
</ArchiveAction>
67+
</Scheme>

Example/Example.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@
444444
PRODUCT_NAME = "$(TARGET_NAME)";
445445
SDKROOT = macosx;
446446
SWIFT_EMIT_LOC_STRINGS = YES;
447+
SWIFT_STRICT_CONCURRENCY = complete;
447448
SWIFT_VERSION = 5.0;
448449
};
449450
name = Debug;
@@ -474,6 +475,7 @@
474475
PRODUCT_NAME = "$(TARGET_NAME)";
475476
SDKROOT = macosx;
476477
SWIFT_EMIT_LOC_STRINGS = YES;
478+
SWIFT_STRICT_CONCURRENCY = complete;
477479
SWIFT_VERSION = 5.0;
478480
};
479481
name = Release;
@@ -500,6 +502,7 @@
500502
PRODUCT_NAME = "$(TARGET_NAME)";
501503
SDKROOT = appletvos;
502504
SWIFT_EMIT_LOC_STRINGS = YES;
505+
SWIFT_STRICT_CONCURRENCY = complete;
503506
SWIFT_VERSION = 5.0;
504507
TARGETED_DEVICE_FAMILY = 3;
505508
TVOS_DEPLOYMENT_TARGET = 14.0;
@@ -528,6 +531,7 @@
528531
PRODUCT_NAME = "$(TARGET_NAME)";
529532
SDKROOT = appletvos;
530533
SWIFT_EMIT_LOC_STRINGS = YES;
534+
SWIFT_STRICT_CONCURRENCY = complete;
531535
SWIFT_VERSION = 5.0;
532536
TARGETED_DEVICE_FAMILY = 3;
533537
TVOS_DEPLOYMENT_TARGET = 14.0;
@@ -679,6 +683,7 @@
679683
PRODUCT_NAME = "$(TARGET_NAME)";
680684
SUPPORTS_MACCATALYST = NO;
681685
SWIFT_EMIT_LOC_STRINGS = YES;
686+
SWIFT_STRICT_CONCURRENCY = complete;
682687
SWIFT_VERSION = 5.0;
683688
TARGETED_DEVICE_FAMILY = "1,2";
684689
TVOS_DEPLOYMENT_TARGET = 14.0;
@@ -715,6 +720,7 @@
715720
PRODUCT_NAME = "$(TARGET_NAME)";
716721
SUPPORTS_MACCATALYST = NO;
717722
SWIFT_EMIT_LOC_STRINGS = YES;
723+
SWIFT_STRICT_CONCURRENCY = complete;
718724
SWIFT_VERSION = 5.0;
719725
TARGETED_DEVICE_FAMILY = "1,2";
720726
TVOS_DEPLOYMENT_TARGET = 14.0;
@@ -734,6 +740,7 @@
734740
PRODUCT_BUNDLE_IDENTIFIER = "com.pick-better.ExampleUITests";
735741
PRODUCT_NAME = "$(TARGET_NAME)";
736742
SWIFT_EMIT_LOC_STRINGS = NO;
743+
SWIFT_STRICT_CONCURRENCY = complete;
737744
SWIFT_VERSION = 5.0;
738745
TARGETED_DEVICE_FAMILY = "1,2";
739746
TEST_TARGET_NAME = Example;
@@ -752,6 +759,7 @@
752759
PRODUCT_BUNDLE_IDENTIFIER = "com.pick-better.ExampleUITests";
753760
PRODUCT_NAME = "$(TARGET_NAME)";
754761
SWIFT_EMIT_LOC_STRINGS = NO;
762+
SWIFT_STRICT_CONCURRENCY = complete;
755763
SWIFT_VERSION = 5.0;
756764
TARGETED_DEVICE_FAMILY = "1,2";
757765
TEST_TARGET_NAME = Example;

Example/Shared/Sources/Shared/ContentView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import PickBetter
1010
import SwiftUI
1111

12+
@MainActor
1213
public struct ContentView: View {
1314
@State private var tab: TabOption = .singleValue
1415
@State private var isGridStyle: Bool = true

Example/Shared/Sources/Shared/Item.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 Item: Identifiable {
11+
public struct Item: Identifiable, Sendable {
1212
public let id: Int
1313

1414
public init(id: Int) {

Example/Shared/Sources/Shared/ItemLabel.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import Foundation
1010
import SwiftUI
1111

12+
@MainActor
1213
public struct ItemLabel: View {
1314
private let itemId: String
1415

Example/Shared/Sources/Shared/LazyView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import Foundation
1010
import SwiftUI
1111

12+
@MainActor
1213
public struct LazyView<Content>: View where Content: View {
1314
private let content: () -> Content
1415

Example/Shared/Sources/Shared/MultiValueSelection.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Foundation
1010
import PickBetter
1111
import SwiftUI
1212

13+
@MainActor
1314
public struct MultiValueSelection: View {
1415
private let items: [Item]
1516
private let isGridStyle: Bool

Example/Shared/Sources/Shared/RouteView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import Foundation
1010
import SwiftUI
1111

12+
@MainActor
1213
public struct RouterView<Links, Content>: View where Links: View, Content: View {
1314
@Binding private var selection: AnyHashable
1415
private let links: (Binding<AnyHashable>) -> Links
@@ -39,6 +40,7 @@ public struct RouterView<Links, Content>: View where Links: View, Content: View
3940
}
4041
}
4142

43+
@MainActor
4244
public struct RouteView<Route, Label, Destination>: View where Route: Hashable, Label: View, Destination: View {
4345
private let route: AnyHashable
4446
@Binding private var selection: AnyHashable

Example/Shared/Sources/Shared/SingleOptionalValueSelection.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Foundation
1010
import PickBetter
1111
import SwiftUI
1212

13+
@MainActor
1314
public struct SingleOptionalValueSelection: View {
1415
private let items: [Item]
1516
private let isGridStyle: Bool

0 commit comments

Comments
 (0)