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 | |
/** | |
### Exercises for the viewer | |
- Phase interrupt handling. | |
- Use Swift concurrency. | |
- Color scheme awareness. | |
- Rework animations to be more spring-like à la what shipped in `0.90.0`. |
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 Parsing | |
import Foundation | |
// [SubRip file format spec.](https://en.wikipedia.org/wiki/SubRip#File_format) | |
let sampleSRTString = | |
""" | |
1 | |
00:00:00,540 --> 00:00:00,960 | |
Yo-yo |
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 Preference<PreferenceKey: SwiftUI.PreferenceKey, Content: View>: View | |
where PreferenceKey.Value: Equatable { | |
private let content: (PreferenceKey.Value) -> Content | |
@State private var value: PreferenceKey.Value = PreferenceKey.defaultValue | |
init( | |
_ key: PreferenceKey.Type, |
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
final class ReplaySubject<Output, Failure: Error>: Subject { | |
typealias Output = Output | |
typealias Failure = Failure | |
private let bufferSize: Int | |
private var completion: Subscribers.Completion<Failure>? | |
private var isActive: Bool { /* … */ } |
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 Combine | |
postfix operator ^ | |
postfix func ^ <Publisher: Combine.Publisher>(_ publisher: Publisher) | |
-> AnyPublisher<Publisher.Output, Publisher.Failure> { | |
publisher.eraseToAnyPublisher() | |
} |
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 protocol FoundationErrorWrapper: ErrorProtocol { | |
static func wrappingError(_ error: NSError) -> Self | |
} | |
enum SomeError: ErrorProtocol, FoundationErrorWrapper { | |
case a | |
case wrappingError(NSError) | |
} |
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
extension CharacterSet: StringLiteralConvertible, ExtendedGraphemeClusterLiteralConvertible { | |
public init(stringLiteral value: String) { | |
self.init(charactersIn: value) | |
} | |
public init(extendedGraphemeClusterLiteral value: ExtendedGraphemeClusterType) { | |
self.init(charactersIn: value) | |
} | |
public init(unicodeScalarLiteral value: UnicodeScalarType) { |
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 | |
enum AppDefault { | |
case APIServer, runMode, homeDirectory, reactHost | |
var stringValue: String? { | |
get { | |
return NSUserDefaults.standardUserDefaults().stringForKey(String(self)) | |
} | |
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
final class SampleViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let button = UIButton(type: .System) | |
// ... | |
button.addTarget(self, action: #selector(SampleViewController.buttonTapped(_:)), forControlEvents: .TouchUpInside) |
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
final class SampleViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let button = UIButton(type: .System) | |
// ... | |
button.addTarget(self, action: #selector(SampleViewController.buttonTapped(_:)), forControlEvents: .TouchUpInside) |
NewerOlder