Skip to content

Commit

Permalink
Merge pull request #23 from SwiftedMind/develop
Browse files Browse the repository at this point in the history
Merge 2.0.0
  • Loading branch information
SwiftedMind authored Aug 24, 2023
2 parents 0b5d6f6 + b1335ae commit d44cd17
Show file tree
Hide file tree
Showing 18 changed files with 136 additions and 434 deletions.
15 changes: 15 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 2.0.0

This release mainly removes the dependency to `Queryable` because that should be treated as a fully separate package. Check it out at [https://github.com/SwiftedMind/Queryable](https://github.com/SwiftedMind/Queryable).

Removing this should make it less likely to force major releases on Puddles.

### Changed

- Renamed the concept of adapters to containers since now they are simple `DynamicProperty` structs with a lot more power and generalized use! A detailed explanation will be provided on swiftedmind.com.

### Removed

- Removed `Signal`. This will be coming as a separate Swift package.
- Removed the dependency to `Queryable`, since that is fully separate and makes breaking changes harder to control. Simply add `Queryable` to your project, to keep using it.

## 1.0.0

### Added
Expand Down
57 changes: 37 additions & 20 deletions Examples/PuddlesExamples/PuddlesExamples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
objects = {

/* Begin PBXBuildFile section */
9539F6DA2A5AF417009D3679 /* ExampleAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9539F6D92A5AF417009D3679 /* ExampleAdapter.swift */; };
9539F6DC2A5AF7A3009D3679 /* NumberFactView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9539F6DB2A5AF7A3009D3679 /* NumberFactView.swift */; };
9539F6DE2A5B1538009D3679 /* NumberFactStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9539F6DD2A5B1538009D3679 /* NumberFactStackView.swift */; };
953D02B02A5993D900D1A377 /* Core in Frameworks */ = {isa = PBXBuildFile; productRef = 953D02AF2A5993D900D1A377 /* Core */; };
953D02B32A5A719300D1A377 /* Router.swift in Sources */ = {isa = PBXBuildFile; fileRef = 953D02B22A5A719300D1A377 /* Router.swift */; };
953D02B52A5A71F800D1A377 /* RootRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 953D02B42A5A71F800D1A377 /* RootRouter.swift */; };
953D02B72A5A732400D1A377 /* View+mockProviders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 953D02B62A5A732400D1A377 /* View+mockProviders.swift */; };
953D02B92A5A81F200D1A377 /* ExampleSections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 953D02B82A5A81F200D1A377 /* ExampleSections.swift */; };
954E6CAA2A6966C000083ABA /* QueryableExampleRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954E6CA92A6966C000083ABA /* QueryableExampleRouter.swift */; };
955335572A9798D600D8E23A /* SortableNumberFacts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 955335562A9798D600D8E23A /* SortableNumberFacts.swift */; };
955E513329CB1B1E00202BBA /* ding.wav in Resources */ = {isa = PBXBuildFile; fileRef = 955E513229CB1B1E00202BBA /* ding.wav */; };
955E513729CB416700202BBA /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 955E513629CB416700202BBA /* Strings.swift */; };
95602F1729C8DDDC008EB800 /* Home.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95602F1629C8DDDC008EB800 /* Home.swift */; };
Expand All @@ -30,15 +31,15 @@
95868CA029C85268001F8629 /* swiftgen-localization-template.stencil in Resources */ = {isa = PBXBuildFile; fileRef = 95868C9A29C85268001F8629 /* swiftgen-localization-template.stencil */; };
95868CB129C857A9001F8629 /* Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95868CAF29C857A9001F8629 /* Assets.swift */; };
95868CC729C863A5001F8629 /* TrailingIconLabelStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95868CC629C863A5001F8629 /* TrailingIconLabelStyle.swift */; };
9594A3EE2A9796A900F82FF7 /* Queryable in Frameworks */ = {isa = PBXBuildFile; productRef = 9594A3ED2A9796A900F82FF7 /* Queryable */; };
95B746DE2A5F0CBB00615C9A /* ExperimentProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95B746DD2A5F0CBB00615C9A /* ExperimentProvider.swift */; };
95C154B229C86A4700224B4B /* DisclosureItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C154B129C86A4700224B4B /* DisclosureItem.swift */; };
95C154B729C86C7300224B4B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95C154B629C86C7300224B4B /* Assets.xcassets */; };
95CCB9242A21E8B500E94681 /* Root.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95CCB9232A21E8B500E94681 /* Root.swift */; };
95E9CFA82A5A982100315BFA /* StaticExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9CFA72A5A982100315BFA /* StaticExample.swift */; };
95E9CFAA2A5A985400315BFA /* BasicProviderExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9CFA92A5A985400315BFA /* BasicProviderExample.swift */; };
95E9CFAE2A5A986A00315BFA /* AdapterExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9CFAD2A5A986A00315BFA /* AdapterExample.swift */; };
95E9CFAE2A5A986A00315BFA /* ContainerExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9CFAD2A5A986A00315BFA /* ContainerExample.swift */; };
95E9CFB02A5A987300315BFA /* QueryableExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9CFAF2A5A987300315BFA /* QueryableExample.swift */; };
95E9CFB22A5A987A00315BFA /* SignalExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9CFB12A5A987A00315BFA /* SignalExample.swift */; };
95E9CFB52A5A9BF400315BFA /* FavoriteNumbersSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9CFB42A5A9BF400315BFA /* FavoriteNumbersSection.swift */; };
95E9CFB72A5ADD4500315BFA /* CultureMindsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9CFB62A5ADD4500315BFA /* CultureMindsProvider.swift */; };
95E9CFB92A5AE07C00315BFA /* NumberFactProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9CFB82A5AE07C00315BFA /* NumberFactProvider.swift */; };
Expand All @@ -47,14 +48,15 @@

/* Begin PBXFileReference section */
952B2B3329CBF9E0004A73F7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9539F6D92A5AF417009D3679 /* ExampleAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleAdapter.swift; sourceTree = "<group>"; };
9539F6DB2A5AF7A3009D3679 /* NumberFactView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberFactView.swift; sourceTree = "<group>"; };
9539F6DD2A5B1538009D3679 /* NumberFactStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberFactStackView.swift; sourceTree = "<group>"; };
953D02AE2A5993C200D1A377 /* Core */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Core; sourceTree = "<group>"; };
953D02B22A5A719300D1A377 /* Router.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Router.swift; sourceTree = "<group>"; };
953D02B42A5A71F800D1A377 /* RootRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootRouter.swift; sourceTree = "<group>"; };
953D02B62A5A732400D1A377 /* View+mockProviders.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+mockProviders.swift"; sourceTree = "<group>"; };
953D02B82A5A81F200D1A377 /* ExampleSections.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleSections.swift; sourceTree = "<group>"; };
954E6CA92A6966C000083ABA /* QueryableExampleRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueryableExampleRouter.swift; sourceTree = "<group>"; };
955335562A9798D600D8E23A /* SortableNumberFacts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortableNumberFacts.swift; sourceTree = "<group>"; };
955E513229CB1B1E00202BBA /* ding.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = ding.wav; sourceTree = "<group>"; };
955E513629CB416700202BBA /* Strings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
95602F1629C8DDDC008EB800 /* Home.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Home.swift; sourceTree = "<group>"; };
Expand All @@ -76,9 +78,8 @@
95E9CFA62A5A97F300315BFA /* Puddles */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Puddles; path = ../..; sourceTree = "<group>"; };
95E9CFA72A5A982100315BFA /* StaticExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StaticExample.swift; sourceTree = "<group>"; };
95E9CFA92A5A985400315BFA /* BasicProviderExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicProviderExample.swift; sourceTree = "<group>"; };
95E9CFAD2A5A986A00315BFA /* AdapterExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdapterExample.swift; sourceTree = "<group>"; };
95E9CFAD2A5A986A00315BFA /* ContainerExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerExample.swift; sourceTree = "<group>"; };
95E9CFAF2A5A987300315BFA /* QueryableExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueryableExample.swift; sourceTree = "<group>"; };
95E9CFB12A5A987A00315BFA /* SignalExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignalExample.swift; sourceTree = "<group>"; };
95E9CFB42A5A9BF400315BFA /* FavoriteNumbersSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteNumbersSection.swift; sourceTree = SOURCE_ROOT; };
95E9CFB62A5ADD4500315BFA /* CultureMindsProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CultureMindsProvider.swift; sourceTree = "<group>"; };
95E9CFB82A5AE07C00315BFA /* NumberFactProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberFactProvider.swift; sourceTree = "<group>"; };
Expand All @@ -93,6 +94,7 @@
95868C8929C851F2001F8629 /* IdentifiedCollections in Frameworks */,
95868C8629C851E8001F8629 /* Puddles in Frameworks */,
953D02B02A5993D900D1A377 /* Core in Frameworks */,
9594A3EE2A9796A900F82FF7 /* Queryable in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -104,13 +106,15 @@
children = (
953D02B22A5A719300D1A377 /* Router.swift */,
953D02B42A5A71F800D1A377 /* RootRouter.swift */,
954E6CA92A6966C000083ABA /* QueryableExampleRouter.swift */,
);
path = Router;
sourceTree = "<group>";
};
954FA2642A17F5B4006F26FC /* Providers */ = {
isa = PBXGroup;
children = (
955335552A9798C200D8E23A /* Container */,
95E9CFB62A5ADD4500315BFA /* CultureMindsProvider.swift */,
95E9CFB82A5AE07C00315BFA /* NumberFactProvider.swift */,
95B746DD2A5F0CBB00615C9A /* ExperimentProvider.swift */,
Expand All @@ -125,6 +129,14 @@
name = Frameworks;
sourceTree = "<group>";
};
955335552A9798C200D8E23A /* Container */ = {
isa = PBXGroup;
children = (
955335562A9798D600D8E23A /* SortableNumberFacts.swift */,
);
path = Container;
sourceTree = "<group>";
};
95868C6829C851C6001F8629 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -216,15 +228,6 @@
path = Localizables;
sourceTree = "<group>";
};
95E9CFB32A5A98AE00315BFA /* AdapterExample */ = {
isa = PBXGroup;
children = (
95E9CFAD2A5A986A00315BFA /* AdapterExample.swift */,
9539F6D92A5AF417009D3679 /* ExampleAdapter.swift */,
);
path = AdapterExample;
sourceTree = "<group>";
};
95EC65842A180717005BDDC0 /* Components */ = {
isa = PBXGroup;
children = (
Expand All @@ -247,9 +250,8 @@
95602F1629C8DDDC008EB800 /* Home.swift */,
95E9CFA72A5A982100315BFA /* StaticExample.swift */,
95E9CFA92A5A985400315BFA /* BasicProviderExample.swift */,
95E9CFB32A5A98AE00315BFA /* AdapterExample */,
95E9CFAD2A5A986A00315BFA /* ContainerExample.swift */,
95E9CFAF2A5A987300315BFA /* QueryableExample.swift */,
95E9CFB12A5A987A00315BFA /* SignalExample.swift */,
);
path = Modules;
sourceTree = "<group>";
Expand All @@ -275,6 +277,7 @@
95868C8529C851E8001F8629 /* Puddles */,
95868C8829C851F2001F8629 /* IdentifiedCollections */,
953D02AF2A5993D900D1A377 /* Core */,
9594A3ED2A9796A900F82FF7 /* Queryable */,
);
productName = PuddlesExamples;
productReference = 95868C7129C851C6001F8629 /* PuddlesExamples.app */;
Expand Down Expand Up @@ -307,6 +310,7 @@
packageReferences = (
95868C8229C851E8001F8629 /* XCRemoteSwiftPackageReference "Puddles" */,
95868C8729C851F2001F8629 /* XCRemoteSwiftPackageReference "swift-identified-collections" */,
9594A3EC2A9796A900F82FF7 /* XCRemoteSwiftPackageReference "Queryable" */,
);
productRefGroup = 95868C7229C851C6001F8629 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -366,26 +370,26 @@
9539F6DE2A5B1538009D3679 /* NumberFactStackView.swift in Sources */,
95E9CFB52A5A9BF400315BFA /* FavoriteNumbersSection.swift in Sources */,
953D02B32A5A719300D1A377 /* Router.swift in Sources */,
95E9CFB22A5A987A00315BFA /* SignalExample.swift in Sources */,
95B746DE2A5F0CBB00615C9A /* ExperimentProvider.swift in Sources */,
95E9CFA82A5A982100315BFA /* StaticExample.swift in Sources */,
953D02B72A5A732400D1A377 /* View+mockProviders.swift in Sources */,
95C154B229C86A4700224B4B /* DisclosureItem.swift in Sources */,
95E9CFBB2A5AED0D00315BFA /* CultureMindNameStackView.swift in Sources */,
9539F6DA2A5AF417009D3679 /* ExampleAdapter.swift in Sources */,
955E513729CB416700202BBA /* Strings.swift in Sources */,
953D02B92A5A81F200D1A377 /* ExampleSections.swift in Sources */,
95E9CFB02A5A987300315BFA /* QueryableExample.swift in Sources */,
95E9CFAE2A5A986A00315BFA /* AdapterExample.swift in Sources */,
95E9CFAE2A5A986A00315BFA /* ContainerExample.swift in Sources */,
953D02B52A5A71F800D1A377 /* RootRouter.swift in Sources */,
95868C7529C851C6001F8629 /* App.swift in Sources */,
95E9CFB72A5ADD4500315BFA /* CultureMindsProvider.swift in Sources */,
954E6CAA2A6966C000083ABA /* QueryableExampleRouter.swift in Sources */,
95868CC729C863A5001F8629 /* TrailingIconLabelStyle.swift in Sources */,
95868CB129C857A9001F8629 /* Assets.swift in Sources */,
95E9CFB92A5AE07C00315BFA /* NumberFactProvider.swift in Sources */,
957850AE2A5F1469002C3EDC /* ExperimentListSection.swift in Sources */,
95E9CFAA2A5A985400315BFA /* BasicProviderExample.swift in Sources */,
9539F6DC2A5AF7A3009D3679 /* NumberFactView.swift in Sources */,
955335572A9798D600D8E23A /* SortableNumberFacts.swift in Sources */,
95602F1729C8DDDC008EB800 /* Home.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -613,6 +617,14 @@
minimumVersion = 0.7.0;
};
};
9594A3EC2A9796A900F82FF7 /* XCRemoteSwiftPackageReference "Queryable" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SwiftedMind/Queryable";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.0.1;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -630,6 +642,11 @@
package = 95868C8729C851F2001F8629 /* XCRemoteSwiftPackageReference "swift-identified-collections" */;
productName = IdentifiedCollections;
};
9594A3ED2A9796A900F82FF7 /* Queryable */ = {
isa = XCSwiftPackageProductDependency;
package = 9594A3EC2A9796A900F82FF7 /* XCRemoteSwiftPackageReference "Queryable" */;
productName = Queryable;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 95868C6929C851C6001F8629 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftedMind/Queryable",
"state" : {
"revision" : "7677089e3f0db3544ed657c18ed051a18f6dd781",
"version" : "1.0.2"
"revision" : "0eb2cfdd868cd5c9b9db4c930d6410d1328f85e8",
"version" : "2.0.1"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,12 @@ struct AdvancedExamplesSection: View {

var body: some View {
Section {
Button("Adapters") {
interface.send(.openAdapterExample)
Button("Containers") {
interface.send(.openContainerExample)
}
Button("Queryables") {
interface.send(.openQueryableExample)
}
Button("Signals") {
interface.send(.openSignalExample)
}
} header: {
Text("Basic")
}
Expand All @@ -74,9 +71,8 @@ struct AdvancedExamplesSection: View {

extension AdvancedExamplesSection {
enum Action: Hashable {
case openAdapterExample
case openContainerExample
case openQueryableExample
case openSignalExample
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,36 @@

import Puddles
import SwiftUI
import Models

struct AdapterExample: View {
@ObservedObject var adapter: ExampleAdapter
@MainActor
struct ContainerExample: View {
@Environment(\.dismiss) private var dismiss

/// A "container" that accesses the NumberFactProvider from the current
/// environment and provides additional states and methods to store and
/// sort number facts.
///
/// This logic could be place inside this view, but extracting it makes it reusable, while still staying fully mockable (since it can access
/// the environment itself. We don't have to pass it in.)
var numberFacts = SortableNumberFacts()

var body: some View {
NavigationStack {
List {
Button("Add Random Number Fact") {
adapter.fetchRandomFact()
numberFacts.fetchRandomFact()
}
Section {
Button("Sort") {
adapter.sort()
numberFacts.sort()
}
NumberFactStackView(numberFacts: adapter.facts, interface: .consume(handleViewInterface))
NumberFactStackView(numberFacts: numberFacts.facts, interface: .consume(handleViewInterface))
} footer: {
Text("Data provided by [NumbersAPI.com](https://numbersapi.com)")
}
}
.animation(.default, value: adapter.facts)
.animation(.default, value: numberFacts.facts)
.navigationTitle("Random Facts")
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Expand All @@ -52,7 +61,7 @@ struct AdapterExample: View {
}
ToolbarItem {
Button("Remove All", role: .destructive) {
adapter.reset()
numberFacts.reset()
}
}
}
Expand All @@ -63,14 +72,14 @@ struct AdapterExample: View {
private func handleViewInterface(_ action: NumberFactStackView.Action) {
switch action {
case .deleteFacts(let indexSet):
adapter.facts.remove(atOffsets: indexSet)
numberFacts.facts.remove(atOffsets: indexSet)
}
}
}

struct AdapterExample_Previews: PreviewProvider {
struct ContainerExample_Previews: PreviewProvider {
static var previews: some View {
AdapterExample(adapter: .init(numberFactProvider: .mock))
ContainerExample()
.withMockProviders()
}
}
Expand Down
Loading

0 comments on commit d44cd17

Please sign in to comment.