Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.
You've got two main options:
| public struct Tuple<each T> { | |
| public private(set) var value: (repeat each T) | |
| public init(_ value: repeat each T) { self.value = (repeat each value) } | |
| } | |
| extension Tuple { | |
| public func map<each U>( | |
| _ transform: (repeat each T) throws -> (repeat each U) | |
| ) rethrows -> (repeat each U) { |
| import UIKit | |
| import Foundation | |
| // NOTE: This playground shows how to use Swift's AttributedString with Markdown. | |
| // | |
| // This code was used to display Markdown content in the Tot iOS Widget <https://tot.rocks> | |
| // MARK: - Helpful Links | |
| // NOTE: The following links helped me figure this stuff out. |
| extension AnyPublisher where Failure: Error { | |
| struct Subscriber: Sendable { | |
| fileprivate let send: @Sendable (Output) -> Void | |
| fileprivate let complete: @Sendable (Subscribers.Completion<Failure>) -> Void | |
| func send(_ value: Output) { self.send(value) } | |
| func send(completion: Subscribers.Completion<Failure>) { self.complete(completion) } | |
| } | |
| init(_ closure: (Subscriber) -> AnyCancellable) { |
| #!/bin/bash -euo pipefail | |
| # | |
| # Author: O.Halligon | |
| # Jan 2021 | |
| # | |
| # Help | |
| if [ "${1:-}" == "-h" -o "${1:-}" == "--help" ]; then | |
| BASENAME=${0##*/} |
| import CloudKit | |
| import Combine | |
| /// Fetches the user's CloudKit Account status. | |
| /// | |
| /// - Parameter container: The container to check the status in. | |
| /// | |
| /// - Returns: A deferred future that resolves to the user's CloudKit Account status. | |
| func getAccountStatus(for container: CKContainer) -> AnyPublisher<CKAccountStatus, Error> { | |
| Deferred { |
| import SwiftUI | |
| enum ScalableFont { | |
| case system(size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default) | |
| case custom(_ name: String, size: CGFloat) | |
| var size: CGFloat { | |
| switch self { |
| import Foundation | |
| public protocol DefaultValue { | |
| associatedtype Value: Codable | |
| static var value: Value { get } | |
| } | |
| @propertyWrapper | |
| public struct Default<Default: DefaultValue>: Codable { |