This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
RootView() | |
.modifier(RootViewModifier()) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Security | |
import Foundation | |
import CoreFoundation | |
typealias KeychainQuery = [CFString: Any] | |
typealias KeychainQueryItems = [KeychainQuery] | |
struct KeychainError: Error { | |
var status: OSStatus | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public enum Method : String, Hashable { | |
case options, get, head, post, put, delete, trace, connect | |
} | |
public struct HeaderField : Hashable { | |
public let rawValue: String | |
public init(_ rawValue: String) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@State private var bounds: Bounds = .zero | |
var body: some View { | |
VStack { | |
controls | |
scrollArea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift 4.2 | |
import Foundation | |
/// A value type representing a path comprized of components separated by "/" | |
public struct Path: Hashable { | |
public typealias Component = String | |
private(set) public var rawValue: String = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift 4.2 | |
public class MutableVariable<A>: Variable<A> { | |
public typealias Transform = (inout A) -> Void | |
internal typealias Mutate = (@escaping Transform) -> Void | |
override public class func threadSafe(_ initial: A) -> MutableVariable<A> { | |
return MutableVariable(initial, queue: DispatchQueue(label: "com.shawnthroop.sting.\(self)", attributes: .concurrent)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift 4.2 | |
public struct Endpoint: Equatable { | |
public typealias Query = Set<QueryItem> | |
public typealias Headers = [HeaderField: String] | |
public enum Method: Equatable { | |
case get | |
case post(Body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift 4.1 | |
import Foundation | |
import Sting | |
struct Account: Equatable { | |
var id: Int | |
} | |
struct Accounts { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift 4.1 | |
/// A type-erased encodable value | |
public struct AnyEncodable { | |
public var base: Any { | |
return value.base | |
} | |
private let value: AnyEquatable | |
private let encodeValue: (Encoder, AnyEquatable) throws -> Void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift 4.1 | |
protocol AnyEquatable { | |
func isEqual(to value: Any) -> Bool | |
} | |
extension AnyEquatable where Self: Equatable { | |
func isEqual(to value: Any) -> Bool { | |
guard let value = value as? Self else { | |
return false |
NewerOlder