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 Result { | |
public func `catch`(_ handler: () throws -> Success) -> Result<Success, Error> { | |
flatMapError { _ in | |
.init { try handler() } | |
} | |
} | |
public func `catch`(_ handler: (Failure) throws -> Success) -> Result<Success, Error> { | |
flatMapError { error in | |
.init { try handler(error) } |
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
#if DEBUG | |
import SwiftUI | |
struct PreviewProviderModifier: ViewModifier { | |
/// Whether or not a basic light mode preview is included in the group. | |
var includeLightMode: Bool | |
/// Whether or not a basic dark mode preview is included in the group. | |
var includeDarkMode: Bool |
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
class ShadowCutoutView: UIView { | |
var contentView: UIView? { | |
didSet { | |
oldValue?.removeFromSuperview() | |
guard let contentView else { | |
return | |
} | |
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight] |