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
/// One of the motivations for this gist is a protocol that receives a Generic value and needs to return a value that may or may not be an optional. | |
/// Something like: | |
/// | |
/// protocol Parser { | |
/// static func parse<T: Decodable>(data: Data) -> T? | |
/// } | |
/// | |
/// This causes the issue of having to check the response type, even when you don't want to accept a nil value (ever) | |
/// let response: String? = parser.parse(data: Data()) | |
/// if response == nil { |
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
struct ListCellView: View { | |
struct Selection: Equatable { | |
let label: String | |
let frame: CGRect | |
} | |
@State private var cellFrame: CGRect = .zero | |
let label: String | |
let action: (Selection) async -> Void |
OlderNewer