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
// Our binder will work universally for every UIView subclass. | |
extension Reactive where Base: UIView { | |
/// Provides an observer that will animate incoming values. | |
/// | |
/// - Parameters: | |
/// - keyPath: keyPath to the property that will be mutated and animated. | |
/// - animator: the animator instance that will be used to animate changes. | |
/// - Returns: a Binder instance. | |
public func animated<Value>( |
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
@discardableResult | |
public func with<T>(_ value: T, _ builder: (T) -> Void) -> T { | |
builder(value) | |
return value | |
} | |
@discardableResult | |
public func with<T>(_ value: T, _ builder: (T) throws -> Void ) rethrows -> T { | |
try builder(value) | |
return value |
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 | |
/// Allows for asynchronously providing an item that will be shared | |
/// in an UIActivityViewController instance. | |
/// | |
/// ### Usage: ### | |
/// ``` | |
/// let activityItem = AsyncActivityItemProvider(placeholderItem: placeholderItem) { [weak self] (activityType, handler) in | |
/// // ⚠️ We're in a background thread. | |
/// |
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 extension AnyTransition { | |
static var carousel: AnyTransition { | |
.asymmetric( | |
insertion: .move(edge: .top) | |
.combined( | |
with: .modifier( | |
active: CarouselTransitionModifier(state: .insert), | |
identity: CarouselTransitionModifier(state: .identity) |
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 InputField<Value: Equatable> { | |
/// The state of current input validation | |
public enum InputValidation: Equatable { | |
/// A value that has undergone validation and is found to be valid. | |
case valid(Value) | |
/// A value that has undergone validation and is found to be invalid. | |
/// Optionally, a feedback message can be displayed to the user | |
/// to let them know what the issue with their input is. | |
/// For example: "Please enter a value between 10 and 100." | |
case invalid(Value, feedback: String?) |
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
struct SomeFeature: ReducerProtocol { | |
struct State: Equatable {} | |
enum Action: Equatable { | |
case didAppear | |
case refreshData | |
case didComplete | |
} | |
struct Input { | |
var shouldRefresh: () -> AsyncStream<Void> |