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

Migrate to The Composable Architecture #3

Merged
merged 2 commits into from Jan 29, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@ xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
*.xcuserdatad

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
Expand Down
84 changes: 61 additions & 23 deletions Lace.xcodeproj/project.pbxproj
Expand Up @@ -13,16 +13,18 @@
725B5DF327A4436300459EE3 /* PlayerCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725B5DF127A4436300459EE3 /* PlayerCore.swift */; };
725B5DF527A44BE900459EE3 /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725B5DF427A44BE900459EE3 /* PlayerView.swift */; };
725B5DF627A44BE900459EE3 /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725B5DF427A44BE900459EE3 /* PlayerView.swift */; };
72D5928027A5918A00D3CE52 /* ComposableArchitecture in Frameworks */ = {isa = PBXBuildFile; productRef = 72D5927F27A5918A00D3CE52 /* ComposableArchitecture */; };
72D5928227A591A100D3CE52 /* ComposableArchitecture in Frameworks */ = {isa = PBXBuildFile; productRef = 72D5928127A591A100D3CE52 /* ComposableArchitecture */; };
72D5928C27A5A21E00D3CE52 /* AppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72D5928B27A5A21E00D3CE52 /* AppView.swift */; };
72D5928D27A5A21E00D3CE52 /* AppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72D5928B27A5A21E00D3CE52 /* AppView.swift */; };
72D5928F27A5B2E700D3CE52 /* AppCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72D5928E27A5B2E700D3CE52 /* AppCore.swift */; };
72D5929027A5B2E700D3CE52 /* AppCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72D5928E27A5B2E700D3CE52 /* AppCore.swift */; };
72E1793C27A2E48D009A20ED /* LaceApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72E1792C27A2E48C009A20ED /* LaceApp.swift */; };
72E1793D27A2E48D009A20ED /* LaceApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72E1792C27A2E48C009A20ED /* LaceApp.swift */; };
72E1793E27A2E48D009A20ED /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72E1792D27A2E48C009A20ED /* HomeView.swift */; };
72E1793F27A2E48D009A20ED /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72E1792D27A2E48C009A20ED /* HomeView.swift */; };
72E1794027A2E48D009A20ED /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 72E1792E27A2E48D009A20ED /* Assets.xcassets */; };
72E1794127A2E48D009A20ED /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 72E1792E27A2E48D009A20ED /* Assets.xcassets */; };
72E1794D27A39502009A20ED /* HomeCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72E1794C27A39502009A20ED /* HomeCore.swift */; };
72E1795027A3955C009A20ED /* LaceKit in Frameworks */ = {isa = PBXBuildFile; productRef = 72E1794F27A3955C009A20ED /* LaceKit */; };
72E1795227A39561009A20ED /* LaceKit in Frameworks */ = {isa = PBXBuildFile; productRef = 72E1795127A39561009A20ED /* LaceKit */; };
72E1795327A396F9009A20ED /* HomeCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72E1794C27A39502009A20ED /* HomeCore.swift */; };
72E1795627A3AC50009A20ED /* Mixtape+Icons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72E1795527A3AC50009A20ED /* Mixtape+Icons.swift */; };
72E1795727A3AC50009A20ED /* Mixtape+Icons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72E1795527A3AC50009A20ED /* Mixtape+Icons.swift */; };
/* End PBXBuildFile section */
Expand All @@ -32,14 +34,14 @@
7221DB0527A489F400183057 /* Lace--iOS--Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Lace--iOS--Info.plist"; sourceTree = "<group>"; };
725B5DF127A4436300459EE3 /* PlayerCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerCore.swift; sourceTree = "<group>"; };
725B5DF427A44BE900459EE3 /* PlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = "<group>"; };
72D5928B27A5A21E00D3CE52 /* AppView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppView.swift; sourceTree = "<group>"; };
72D5928E27A5B2E700D3CE52 /* AppCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCore.swift; sourceTree = "<group>"; };
72E1792C27A2E48C009A20ED /* LaceApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaceApp.swift; sourceTree = "<group>"; };
72E1792D27A2E48C009A20ED /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; };
72E1792E27A2E48D009A20ED /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
72E1793327A2E48D009A20ED /* Lace.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Lace.app; sourceTree = BUILT_PRODUCTS_DIR; };
72E1793927A2E48D009A20ED /* Lace.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Lace.app; sourceTree = BUILT_PRODUCTS_DIR; };
72E1793B27A2E48D009A20ED /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = "<group>"; };
72E1794A27A37C44009A20ED /* LaceKit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = LaceKit; sourceTree = "<group>"; };
72E1794C27A39502009A20ED /* HomeCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeCore.swift; sourceTree = "<group>"; };
72E1795527A3AC50009A20ED /* Mixtape+Icons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Mixtape+Icons.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -48,6 +50,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
72D5928227A591A100D3CE52 /* ComposableArchitecture in Frameworks */,
72E1795027A3955C009A20ED /* LaceKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -56,6 +59,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
72D5928027A5918A00D3CE52 /* ComposableArchitecture in Frameworks */,
72E1795227A39561009A20ED /* LaceKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -71,14 +75,31 @@
path = iOS;
sourceTree = "<group>";
};
725B5DF027A4435000459EE3 /* Player */ = {
725B5DF027A4435000459EE3 /* Playback */ = {
isa = PBXGroup;
children = (
725B5DF127A4436300459EE3 /* PlayerCore.swift */,
);
path = Playback;
sourceTree = "<group>";
};
72D5928627A5986200D3CE52 /* Main */ = {
isa = PBXGroup;
children = (
72D5929127A5B4C500D3CE52 /* Playback */,
72D5928B27A5A21E00D3CE52 /* AppView.swift */,
72D5928E27A5B2E700D3CE52 /* AppCore.swift */,
);
path = Main;
sourceTree = "<group>";
};
72D5929127A5B4C500D3CE52 /* Playback */ = {
isa = PBXGroup;
children = (
725B5DF427A44BE900459EE3 /* PlayerView.swift */,
7221DB0227A47D7C00183057 /* PlayableArtworkPlaceholderView.swift */,
);
path = Player;
path = Playback;
sourceTree = "<group>";
};
72E1792627A2E48C009A20ED = {
Expand All @@ -96,9 +117,9 @@
72E1792B27A2E48C009A20ED /* Shared */ = {
isa = PBXGroup;
children = (
725B5DF027A4435000459EE3 /* Player */,
72D5928627A5986200D3CE52 /* Main */,
725B5DF027A4435000459EE3 /* Playback */,
72E1795427A3AC3C009A20ED /* Utility */,
72E1794B27A394D1009A20ED /* Home */,
72E1792C27A2E48C009A20ED /* LaceApp.swift */,
72E1792E27A2E48D009A20ED /* Assets.xcassets */,
);
Expand All @@ -122,15 +143,6 @@
path = macOS;
sourceTree = "<group>";
};
72E1794B27A394D1009A20ED /* Home */ = {
isa = PBXGroup;
children = (
72E1792D27A2E48C009A20ED /* HomeView.swift */,
72E1794C27A39502009A20ED /* HomeCore.swift */,
);
path = Home;
sourceTree = "<group>";
};
72E1794E27A3955C009A20ED /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -164,6 +176,7 @@
name = "Lace (iOS)";
packageProductDependencies = (
72E1794F27A3955C009A20ED /* LaceKit */,
72D5928127A591A100D3CE52 /* ComposableArchitecture */,
);
productName = "Lace (iOS)";
productReference = 72E1793327A2E48D009A20ED /* Lace.app */;
Expand All @@ -184,6 +197,7 @@
name = "Lace (macOS)";
packageProductDependencies = (
72E1795127A39561009A20ED /* LaceKit */,
72D5927F27A5918A00D3CE52 /* ComposableArchitecture */,
);
productName = "Lace (macOS)";
productReference = 72E1793927A2E48D009A20ED /* Lace.app */;
Expand Down Expand Up @@ -216,6 +230,9 @@
Base,
);
mainGroup = 72E1792627A2E48C009A20ED;
packageReferences = (
72D5927E27A5918A00D3CE52 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */,
);
productRefGroup = 72E1793427A2E48D009A20ED /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -250,11 +267,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
72E1793E27A2E48D009A20ED /* HomeView.swift in Sources */,
72E1795627A3AC50009A20ED /* Mixtape+Icons.swift in Sources */,
72E1794D27A39502009A20ED /* HomeCore.swift in Sources */,
72D5928C27A5A21E00D3CE52 /* AppView.swift in Sources */,
7221DB0327A47D7C00183057 /* PlayableArtworkPlaceholderView.swift in Sources */,
725B5DF527A44BE900459EE3 /* PlayerView.swift in Sources */,
72D5928F27A5B2E700D3CE52 /* AppCore.swift in Sources */,
725B5DF227A4436300459EE3 /* PlayerCore.swift in Sources */,
72E1793C27A2E48D009A20ED /* LaceApp.swift in Sources */,
);
Expand All @@ -264,11 +281,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
72E1793F27A2E48D009A20ED /* HomeView.swift in Sources */,
72E1795727A3AC50009A20ED /* Mixtape+Icons.swift in Sources */,
72E1795327A396F9009A20ED /* HomeCore.swift in Sources */,
72D5928D27A5A21E00D3CE52 /* AppView.swift in Sources */,
7221DB0427A47D7C00183057 /* PlayableArtworkPlaceholderView.swift in Sources */,
725B5DF627A44BE900459EE3 /* PlayerView.swift in Sources */,
72D5929027A5B2E700D3CE52 /* AppCore.swift in Sources */,
725B5DF327A4436300459EE3 /* PlayerCore.swift in Sources */,
72E1793D27A2E48D009A20ED /* LaceApp.swift in Sources */,
);
Expand Down Expand Up @@ -539,7 +556,28 @@
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
72D5927E27A5918A00D3CE52 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.9.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
72D5927F27A5918A00D3CE52 /* ComposableArchitecture */ = {
isa = XCSwiftPackageProductDependency;
package = 72D5927E27A5918A00D3CE52 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */;
productName = ComposableArchitecture;
};
72D5928127A591A100D3CE52 /* ComposableArchitecture */ = {
isa = XCSwiftPackageProductDependency;
package = 72D5927E27A5918A00D3CE52 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */;
productName = ComposableArchitecture;
};
72E1794F27A3955C009A20ED /* LaceKit */ = {
isa = XCSwiftPackageProductDependency;
productName = LaceKit;
Expand Down
@@ -0,0 +1,70 @@
{
"object": {
"pins": [
{
"package": "combine-schedulers",
"repositoryURL": "https://github.com/pointfreeco/combine-schedulers",
"state": {
"branch": null,
"revision": "4cf088c29a20f52be0f2ca54992b492c54e0076b",
"version": "0.5.3"
}
},
{
"package": "swift-case-paths",
"repositoryURL": "https://github.com/pointfreeco/swift-case-paths",
"state": {
"branch": null,
"revision": "241301b67d8551c26d8f09bd2c0e52cc49f18007",
"version": "0.8.0"
}
},
{
"package": "swift-collections",
"repositoryURL": "https://github.com/apple/swift-collections",
"state": {
"branch": null,
"revision": "48254824bb4248676bf7ce56014ff57b142b77eb",
"version": "1.0.2"
}
},
{
"package": "swift-composable-architecture",
"repositoryURL": "https://github.com/pointfreeco/swift-composable-architecture",
"state": {
"branch": null,
"revision": "ba9c626ab1b2b6af8cf684eebb2ab472fa5b6753",
"version": "0.33.1"
}
},
{
"package": "swift-custom-dump",
"repositoryURL": "https://github.com/pointfreeco/swift-custom-dump",
"state": {
"branch": null,
"revision": "51698ece74ecf31959d3fa81733f0a5363ef1b4e",
"version": "0.3.0"
}
},
{
"package": "swift-identified-collections",
"repositoryURL": "https://github.com/pointfreeco/swift-identified-collections",
"state": {
"branch": null,
"revision": "680bf440178a78a627b1c2c64c0855f6523ad5b9",
"version": "0.3.2"
}
},
{
"package": "xctest-dynamic-overlay",
"repositoryURL": "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state": {
"branch": null,
"revision": "50a70a9d3583fe228ce672e8923010c8df2deddd",
"version": "0.2.1"
}
}
]
},
"version": 1
}
2 changes: 1 addition & 1 deletion LaceKit/Sources/LaceKit/Models/Link.swift
Expand Up @@ -7,7 +7,7 @@

import Foundation

public struct Link: Codable {
public struct Link: Codable, Equatable {
let href: String
let rel: String
let type: String
Expand Down
8 changes: 4 additions & 4 deletions LaceKit/Sources/LaceKit/Models/LiveBroadcastsResponse.swift
Expand Up @@ -7,8 +7,8 @@

import Foundation

public struct Broadcast: Codable {
public struct Embed: Codable {
public struct Broadcast: Codable, Equatable {
public struct Embed: Codable, Equatable {
public let status: String
public let updated: Date
public let name: String
Expand All @@ -34,7 +34,7 @@ public struct Broadcast: Codable {
public let embeds: [String: Embed]
}

public struct Channel: Codable {
public struct Channel: Codable, Equatable {
public let channelName: String
public let now: Broadcast
public let next: Broadcast
Expand All @@ -43,7 +43,7 @@ public struct Channel: Codable {
public let next4: Broadcast
}

public struct LiveBroadcastsResponse: Codable {
public struct LiveBroadcastsResponse: Codable, Equatable {
public let results: [Channel]
public let links: [Link]
}
Expand Down
2 changes: 1 addition & 1 deletion LaceKit/Sources/LaceKit/Models/Media.swift
Expand Up @@ -7,7 +7,7 @@

import Foundation

public struct Media: Codable {
public struct Media: Codable, Equatable {
public let backgroundLarge: URL?
public let backgroundMediumLarge: URL?
public let backgroundMedium: URL?
Expand Down
4 changes: 2 additions & 2 deletions LaceKit/Sources/LaceKit/Models/Mixtape.swift
Expand Up @@ -7,7 +7,7 @@

import Foundation

public struct Mixtape: Codable {
public struct Mixtape: Codable, Equatable {
public var mixtapeAlias: String
public var title: String
public var subtitle: String
Expand All @@ -19,7 +19,7 @@ public struct Mixtape: Codable {
public var links: [Link]
}

public struct MixtapesResponse: Codable {
public struct MixtapesResponse: Codable, Equatable {
public let results: [Mixtape]
public let links: [Link]
}
Expand Down
10 changes: 5 additions & 5 deletions LaceKit/Sources/LaceKit/Networking/Runner.swift
Expand Up @@ -8,9 +8,9 @@
import Foundation
import Combine

public enum RunnerError: Error {
case network(error: Error)
case decoder(error: Error)
public enum RunnerError: Error, Equatable {
case network(error: String)
case decoder(error: String)
}

public final class Runner {
Expand All @@ -19,7 +19,7 @@ public final class Runner {
public func requestPublisher<T: Codable>(for request: URLRequest) -> AnyPublisher<T, RunnerError> {
session.dataTaskPublisher(for: request)
.mapError({ error in
.network(error: error)
.network(error: error.localizedDescription)
})
.flatMap({ response in
self.requestDecoder(for: response.data)
Expand All @@ -39,7 +39,7 @@ extension Runner {
try decoder.decode(T.self, from: decodable)
})
.mapError({ error in
.decoder(error: error)
.decoder(error: error.localizedDescription)
})
.eraseToAnyPublisher()
}
Expand Down