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 | |
| class Downloader { | |
| static var shared = Downloader() | |
| public func download() async throws -> Data { | |
| // All your logic around returning a cached result, starting a task or await an existing task goes here, as normal. | |
| try await Task.sleep(for: .seconds(5)) | |
| print("Download complete") | |
| return Data() |
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
| // Created by Matt Comi on 12/8/21. | |
| import SwiftUI | |
| struct HeaderView: View { | |
| var body: some View { | |
| VStack(spacing: 6) { | |
| Text("Stampy").font(.title).foregroundColor(.purple).fontWeight(.heavy) | |
| Text("Your Digital Stamp Collection").font(.footnote).foregroundColor(.secondary) | |
| } |
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
| var description: String { | |
| return "\(self.dynamicType)(name: \(name), age: \(age), social: \(social))" | |
| } |
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 Person : ReflectedStringConvertible { | |
| var name: String | |
| var age: Int | |
| var social: Social | |
| init(name: String, age: Int, social: Social) { | |
| self.name = name | |
| self.age = age | |
| self.social = social | |
| } |
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 protocol ReflectedStringConvertible : CustomStringConvertible { } | |
| extension ReflectedStringConvertible { | |
| public var description: String { | |
| let mirror = Mirror(reflecting: self) | |
| var str = "\(mirror.subjectType)(" | |
| var first = true | |
| for (label, value) in mirror.children { | |
| if let label = label { |
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 Social { | |
| var twitter: String | |
| } | |
| struct Person { | |
| var name: String | |
| var age: Int | |
| var social: Social | |
| } |
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
| .gist .blob-num { border-color: rgba(205, 233, 244, 1) !important; border-width: 0 2px 0 0 !important } | |
| .gist .js-file-line-container { margin: 9px 0 0 0 !important; background-color: transparent !important } | |
| .gist .gist-file { border: 0 !important; margin-left: 10px; } | |
| .gist .gist-meta { background-color: transparent !important; color: rgba(0, 0, 0, 0.3) !important; padding-top: 5px !important } | |
| .gist .gist-data { border-bottom: 0 !important } | |
| .gist .gist-meta a:first-child { display: none } | |
| .gist .gist-meta a { color: rgba(0, 0, 0, 0.4) !important } |