| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import Combine | ||
| import Foundation | ||
|
|
||
| public protocol APIService { | ||
| func request<T: Decodable>(with builder: RequestBuilder) -> AnyPublisher<T, APIError> | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| public struct Dimension { | ||
| public let name: String | ||
| public let value: String? | ||
|
|
||
| public init(name: String, value: String?) { | ||
| self.name = name | ||
| self.value = value | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import Foundation | ||
|
|
||
| extension URL { | ||
| public static var example: Self { Self(string: "https://example.com")! } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import SwiftUI | ||
|
|
||
| public struct Colors { | ||
| public static var secondaryText: Color = .gray | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import SwiftUI | ||
| import Toolbox | ||
|
|
||
| public struct DimensionsView: View { | ||
| private let height: String? | ||
| private let spread: String? | ||
| private let diameter: String? | ||
| private let circumference: String? | ||
|
|
||
| public init(height: String?, spread: String?, diameter: String?, circumference: String?) { | ||
| self.height = height | ||
| self.spread = spread | ||
| self.diameter = diameter | ||
| self.circumference = circumference | ||
| } | ||
|
|
||
| public var body: some View { | ||
| HStack(spacing: 16) { | ||
| DimensionGroup(dimensions: [ | ||
| Toolbox.Dimension(name: "Height", value: height), | ||
| Toolbox.Dimension(name: "Spread", value: spread) | ||
| ]) | ||
|
|
||
| Spacer() | ||
|
|
||
| DimensionGroup(dimensions: [ | ||
| Toolbox.Dimension(name: "Diameter", value: diameter), | ||
| Toolbox.Dimension(name: "Circumference", value: circumference) | ||
| ]) | ||
| } | ||
| .padding(.trailing) | ||
| } | ||
| } | ||
|
|
||
| struct DimensionsView_Previews: PreviewProvider { | ||
| static var previews: some View { | ||
| DimensionsView(height: "85 ft", spread: "107 ft", diameter: "48 in", circumference: "12.8 in") | ||
| .autosizedPreview() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import MapKit | ||
| import SwiftUI | ||
| import Toolbox | ||
|
|
||
| let AnnotationViewIdentifier = "Annotation View" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import SafariServices | ||
| import SwiftUI | ||
|
|
||
| public struct SafariView: UIViewControllerRepresentable { | ||
| private let url: URL | ||
|
|
||
| public init(url: URL) { | ||
| self.url = url | ||
| } | ||
|
|
||
| public func makeUIViewController(context: UIViewControllerRepresentableContext<SafariView>) -> SFSafariViewController { | ||
| return SFSafariViewController(url: url) | ||
| } | ||
|
|
||
| public func updateUIViewController(_ uiViewController: SFSafariViewController, context: UIViewControllerRepresentableContext<SafariView>) {} | ||
| } |