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
| When setting `foregroundStyle` on a `AxisValueLabel`, the rendered text color does not change. | |
| Example Code: | |
| ``` | |
| Chart([(0,0), (1,1), (2, 2), (3, 3), (4, 4)], id: \.0) { point in | |
| LineMark(x: .value("X", point.0), y: .value("Y", point.1)) | |
| } | |
| .chartYAxis { | |
| AxisMarks { _ in |
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 | |
| import UIKit | |
| /// Renders the first page of the given PDF file to a `UIImage`. If | |
| /// `maxLength` is given, then the resulting image is scaled to a | |
| /// matching size. | |
| /// | |
| /// Example: If `maxLength` is set to `100.0`, this might result in | |
| /// the following dimensions (since aspect ratio is preserved): | |
| /// |
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
| // Original version from the authors of ComposableArchitecture here: | |
| // https://github.com/pointfreeco/isowords/blob/fcff52ccf176f40db55951d5897def7cd9b879cf/Sources/TcaHelpers/OnChange.swift | |
| // | |
| // The following adds a method for filtering changes with a predicate. | |
| // This is written using reactiveswift-composable-architecture, but can be adapted very quickly for Combine. | |
| import ComposableArchitecture | |
| import ReactiveSwift | |
| public extension Reducer { |
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 | |
| @MainActor | |
| class PhotoStore: ObservableObject { | |
| @Published private(set) var isSaving: Bool = false | |
| // Made nonisolated because Playgrounds does not run on | |
| // @MainActor. There's probably a cleaner way of doing this | |
| nonisolated init() {} |
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 | |
| // Crashes when count is set to 683. Works fine if count < 683. | |
| // Usage: | |
| // func testMessagePassing() throws { | |
| // let coordinator = Coordinator() | |
| // let expectation = XCTestExpectation() | |
| // detach { | |
| // await coordinator.simulateMessengers() |
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 | |
| extension UIImage { | |
| /// Available launch images (as of 12 May 2021): | |
| /// LaunchImage-800-667h@2x.png: 750x1334 | |
| /// LaunchImage-1200-Portrait-1792h@2x.png: 828x1792 | |
| /// LaunchImage-800-Portrait-736h@3x.png: 1242x2208 | |
| /// LaunchImage-1100-Portrait-2436h@3x.png: 1125x2436 | |
| /// LaunchImage-1200-Portrait-2688h@3x.png: 1242x2688 | |
| static var launchImage: UIImage { |
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 | |
| import Combine | |
| func runDelayedInBackground<Output, DelayingScheduler: Scheduler, ReceivingScheduler: Scheduler>( | |
| delay: Int = 200, | |
| scheduler: DelayingScheduler, | |
| receiveOn: ReceivingScheduler, | |
| worker: @escaping () -> Result<Output, Never>, | |
| completion: @escaping (Output) -> () | |
| ) -> AnyCancellable { |
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 | |
| final class A { | |
| func someMethod() {} | |
| } | |
| struct B { | |
| let a: A | |
| func someMethod() {} | |
| } |
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 | |
| import PlaygroundSupport | |
| import UIKit | |
| enum PassingStructInInit { | |
| struct A { | |
| let b: B | |
| } |