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): | |
| /// [email protected]: 750x1334 | |
| /// [email protected]: 828x1792 | |
| /// [email protected]: 1242x2208 | |
| /// [email protected]: 1125x2436 | |
| /// [email protected]: 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 | |
| } |
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
| // MIT License | |
| // | |
| // Copyright (c) 2020 Manuel Maly | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy | |
| // of this software and associated documentation files (the "Software"), to deal | |
| // in the Software without restriction, including without limitation the rights | |
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| // copies of the Software, and to permit persons to whom the Software is | |
| // furnished to do so, subject to the following conditions: | |
| // |