Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sharing dependency #3517

Merged
merged 25 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 17 additions & 26 deletions .github/package.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,6 @@
"version" : "1.0.2"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "41982a3656a71c768319979febd796c6fd111d5c",
"version" : "1.5.0"
}
},
{
"identity" : "swift-benchmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/swift-benchmark",
"state" : {
"revision" : "8163295f6fe82356b0bcf8e1ab991645de17d096",
"version" : "0.1.2"
}
},
{
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -77,8 +59,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "fd1fb25b68fdb9756cd61d23dbd9e2614b340085",
"version" : "1.4.0"
"revision" : "7d2eb4ad20efb2838269645410d26b64ca48d8aa",
"version" : "1.6.1"
}
},
{
Expand Down Expand Up @@ -122,17 +104,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-navigation",
"state" : {
"revision" : "e834b3760731160d7d448509ee6a1408c8582a6b",
"version" : "2.2.0"
"revision" : "16a27ab7ae0abfefbbcba73581b3e2380b47a579",
"version" : "2.2.2"
}
},
{
"identity" : "swift-perception",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-perception",
"state" : {
"revision" : "bc67aa8e461351c97282c2419153757a446ae1c9",
"version" : "1.3.5"
"revision" : "8d52279b9809ef27eabe7d5420f03734528f19da",
"version" : "1.4.1"
}
},
{
"identity" : "swift-sharing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-sharing",
"state" : {
"revision" : "f923992fc911368447074a56da13feadf87f07a0",
"version" : "1.0.2"
}
},
{
Expand All @@ -158,8 +149,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "bc2a151366f2cd0e347274544933bc2acb00c9fe",
"version" : "1.4.0"
"revision" : "a3f634d1a409c7979cabc0a71b3f26ffa9fc8af1",
"version" : "1.4.3"
}
}
],
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions Examples/CaseStudies/CaseStudies.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
CAA9ADCC2446615B0003A984 /* 03-Effects-LongLivingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAA9ADCB2446615B0003A984 /* 03-Effects-LongLivingTests.swift */; };
CABC4F3926AEE00C00D5FA2C /* 03-Effects-Refreshable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABC4F3826AEE00C00D5FA2C /* 03-Effects-Refreshable.swift */; };
CABC4F3B26AEE20200D5FA2C /* 03-Effects-RefreshableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABC4F3A26AEE20200D5FA2C /* 03-Effects-RefreshableTests.swift */; };
CACA7FBC2BC707F2002DF110 /* 02-SharedState-Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = CACA7FBB2BC707F2002DF110 /* 02-SharedState-Notifications.swift */; };
CADECDB62B5CA228009DC881 /* 02-SharedState-InMemory.swift in Sources */ = {isa = PBXBuildFile; fileRef = CADECDB52B5CA228009DC881 /* 02-SharedState-InMemory.swift */; };
CADECDB82B5CA425009DC881 /* 02-SharedState-FileStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = CADECDB72B5CA425009DC881 /* 02-SharedState-FileStorage.swift */; };
CADECDBA2B5CA613009DC881 /* 02-GettingStarted-SharedStateUserDefaultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CADECDB92B5CA613009DC881 /* 02-GettingStarted-SharedStateUserDefaultsTests.swift */; };
Expand Down Expand Up @@ -176,7 +175,6 @@
CAA9ADCB2446615B0003A984 /* 03-Effects-LongLivingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "03-Effects-LongLivingTests.swift"; sourceTree = "<group>"; };
CABC4F3826AEE00C00D5FA2C /* 03-Effects-Refreshable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "03-Effects-Refreshable.swift"; sourceTree = "<group>"; };
CABC4F3A26AEE20200D5FA2C /* 03-Effects-RefreshableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "03-Effects-RefreshableTests.swift"; sourceTree = "<group>"; };
CACA7FBB2BC707F2002DF110 /* 02-SharedState-Notifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "02-SharedState-Notifications.swift"; sourceTree = "<group>"; };
CADECDB52B5CA228009DC881 /* 02-SharedState-InMemory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "02-SharedState-InMemory.swift"; sourceTree = "<group>"; };
CADECDB72B5CA425009DC881 /* 02-SharedState-FileStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "02-SharedState-FileStorage.swift"; sourceTree = "<group>"; };
CADECDB92B5CA613009DC881 /* 02-GettingStarted-SharedStateUserDefaultsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "02-GettingStarted-SharedStateUserDefaultsTests.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -405,7 +403,6 @@
DCC68EDC2447A5B00037F998 /* 01-GettingStarted-OptionalState.swift */,
CADECDB72B5CA425009DC881 /* 02-SharedState-FileStorage.swift */,
CADECDB52B5CA228009DC881 /* 02-SharedState-InMemory.swift */,
CACA7FBB2BC707F2002DF110 /* 02-SharedState-Notifications.swift */,
CADECDBF2B5DE7C1009DC881 /* 02-SharedState-Onboarding.swift */,
CA7BC8ED245CCFE4001FB69F /* 02-SharedState-UserDefaults.swift */,
CAA9ADC12446587C0003A984 /* 03-Effects-Basics.swift */,
Expand Down Expand Up @@ -748,7 +745,6 @@
DCC68EE12447C4630037F998 /* 01-GettingStarted-Composition-TwoCounters.swift in Sources */,
DC072322244663B1003A8B65 /* 04-Navigation-Sheet-LoadThenPresent.swift in Sources */,
DC89C45324465452006900B9 /* 04-Navigation-Lists-NavigateAndLoad.swift in Sources */,
CACA7FBC2BC707F2002DF110 /* 02-SharedState-Notifications.swift in Sources */,
DCC68EE32447C8540037F998 /* 05-HigherOrderReducers-ReusableFavoriting.swift in Sources */,
CA3E421F26B8337500581ABC /* 01-GettingStarted-FocusState.swift in Sources */,
DCC68EDF2447BC810037F998 /* TemplateText.swift in Sources */,
Expand Down
9 changes: 0 additions & 9 deletions Examples/CaseStudies/SwiftUICaseStudies/00-RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ struct RootView: View {
SharedStateFileStorageView(store: store)
}
}
NavigationLink("Notifications") {
Demo(
store: Store(initialState: SharedStateNotifications.State()) {
SharedStateNotifications()
}
) { store in
SharedStateNotificationsView(store: store)
}
}
Button("Sign up flow") {
isSignUpCaseStudyPresented = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ extension SharedStateFileStorage {
return .none

case .decrementButtonTapped:
state.stats.decrement()
state.$stats.withLock { $0.decrement() }
return .none

case .incrementButtonTapped:
state.stats.increment()
state.$stats.withLock { $0.increment() }
return .none

case .isPrimeButtonTapped:
Expand Down Expand Up @@ -136,7 +136,7 @@ extension SharedStateFileStorage {
Reduce { state, action in
switch action {
case .resetStatsButtonTapped:
state.stats = Stats()
state.$stats.withLock { $0 = Stats() }
return .none
}
}
Expand Down Expand Up @@ -223,7 +223,7 @@ struct Stats: Codable, Equatable {
}
}

extension PersistenceReaderKey where Self == FileStorageKey<Stats> {
extension SharedKey where Self == FileStorageKey<Stats> {
fileprivate static var stats: Self {
fileStorage(.documentsDirectory.appending(component: "stats.json"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ extension SharedStateInMemory {
return .none

case .decrementButtonTapped:
state.stats.decrement()
state.$stats.withLock { $0.decrement() }
return .none

case .incrementButtonTapped:
state.stats.increment()
state.$stats.withLock { $0.increment() }
return .none

case .isPrimeButtonTapped:
Expand Down Expand Up @@ -135,7 +135,7 @@ extension SharedStateInMemory {
Reduce { state, action in
switch action {
case .resetStatsButtonTapped:
state.stats = Stats()
state.$stats.withLock { $0 = Stats() }
return .none
}
}
Expand Down Expand Up @@ -211,7 +211,7 @@ private struct ProfileTabView: View {
)
}

extension PersistenceReaderKey where Self == InMemoryKey<Stats> {
extension SharedKey where Self == InMemoryKey<Stats> {
fileprivate static var stats: Self {
inMemory("stats")
}
Expand Down
Loading
Loading