This file contains hidden or 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 | |
| public struct FormattedTextField<Formatter: TextFieldFormatter>: View { | |
| public init(_ title: String, | |
| value: Binding<Formatter.Value>, | |
| formatter: Formatter) { | |
| self.title = title | |
| self.value = value | |
| self.formatter = formatter | |
| } |
This file contains hidden or 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
| APP="MyApp" | |
| CONSTRUCT=xcodebuild -workspace $(APP).xcworkspace -scheme $(APP) clean | |
| install_deps: | |
| pod install | |
| create_config: | |
| swift package fetch | |
| swift package generate-xcodeproj | |
| wipe: | |
| rm -rf .build $(APP).xcodeproj $(APP).xcworkspace Package.pins Pods Podfile.lock |
This file contains hidden or 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
| public class Channel<Value> { | |
| private class Subscription { | |
| weak var object: AnyObject? | |
| private let notifyBlock: (Value) -> Void | |
| private let queue: DispatchQueue | |
| var isValid: Bool { | |
| return object != nil |
This file contains hidden or 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 XCTest | |
| struct Scenario: ScenarioGivenContinuation, ScenarioWhenContinuation { | |
| init(_ description: String) { | |
| print("Scenario: \(description)") | |
| } | |
| struct Given: ScenarioWhenContinuation { | |
| fileprivate init(description: String, setup: () throws -> Void) rethrows { |
This file contains hidden or 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 | |
| let dateFormatter = DateFormatter() | |
| struct NoteItem: Codable, Hashable, Identifiable { | |
| let id: Int | |
| let text: String | |
| var date = Date() | |
| var dateText: String { | |
| dateFormatter.dateFormat = "MMM d yyyy, h:mm a" |
This file contains hidden or 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
| public enum Direction { | |
| case forward | |
| case backward | |
| } | |
| internal var player: AVPlayer? | |
| private var isSeekInProgress = false | |
| private var chaseTime = kCMTimeZero | |
| private var preferredFrameRate: Float = 23.98 |
This file contains hidden or 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 final class Store<Element>: RangeReplaceableCollection { | |
| public typealias Index = Int | |
| public typealias SubSequence = Store<Element> | |
| public var startIndex: Index { queue.sync { storage.startIndex } } | |
| public var endIndex: Index { queue.sync { storage.endIndex } } | |
| public func index(after i: Index) -> Index { queue.sync { storage.index(after: i) } } |
This file contains hidden or 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
| private func flipped(size: CGSize) -> CGAffineTransform { | |
| let mirror = CGAffineTransform(scaleX: 1, y: -1) | |
| let translate = CGAffineTransform(translationX: 0, y: size.height) | |
| return mirror.concatenating(translate) | |
| } |
This file contains hidden or 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
| extension Encodable { | |
| var debugJson: String { | |
| (try? JSONEncoder().encode(self).debugJson) ?? "" | |
| } | |
| } | |
| extension Data { | |
| var debugJson: String { | |
| String(decoding: self, as: UTF8.self) | |
| } |
This file contains hidden or 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 UIKit | |
| /// Decorates a view as a `Card`. Requires that the view is embedded in some `contentView` | |
| public protocol CardDecorating { | |
| /// View that will be styled as a card. Should hold the `contentView`. | |
| var cardView: UIView { get } | |
| /// Holds the main content. Subviews should be added to this view. | |
| var contentView: UIView { get } | |
| } |