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
| @available(iOS 3.0, *) | |
| public enum Code : Int { | |
| public typealias _ErrorType = SKError | |
| case unknown = 0 | |
| case clientInvalid = 1 // client is not allowed to issue the request, etc. | |
| case paymentCancelled = 2 // user cancelled the request, etc. |
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
| PHPhotoLibrary.requestAuthorization(for: .readWrite) { status in | |
| if status == .authorized { | |
| var infos: [(CLLocation, Date)] = [] | |
| do { | |
| let options = PHFetchOptions() | |
| options.includeHiddenAssets = true | |
| PHAsset.fetchAssets(with: options).enumerateObjects { asset, _, _ in | |
| if let location = asset.location, | |
| let date = asset.creationDate | |
| { |
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
| private final class AppInfo { | |
| private struct Keys { | |
| static let lastKnownAppVersion = "app_data.last_known_app_version" | |
| static let appWasInBackground = "app_data.app_was_in_background" | |
| static let appWasTerminated = "app_data.app_was_terminated" | |
| } | |
| struct State { | |
| let appVersionIsChanged: Bool | |
| let appWasInBackground: Bool |
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
| abacus | |
| accordion | |
| acorn | |
| acrobat | |
| adult | |
| adult_cat | |
| agriculture | |
| aircraft | |
| airplane | |
| airport |
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
| func testMultiThreadReadWriteRelations() { | |
| TestDB.temporaryContainer(store: DataModels.bookLibrary) { pc in | |
| let group = DispatchGroup() | |
| let range = 1 ... 100 | |
| try pc.perform { ctx in | |
| try ctx.insert(BookLibrary.Author(id: .init(), name: "Leo", age: 100)) | |
| } |
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
| extension MTLCaptureManager { | |
| @discardableResult | |
| func capture<T>(with commandQueue: MTLCommandQueue, _ action: () throws -> T) throws -> T { | |
| let scope = self.makeCaptureScope(commandQueue: commandQueue) | |
| let descriptor = MTLCaptureDescriptor() | |
| descriptor.captureObject = scope | |
| try self.startCapture(with: descriptor) | |
| scope.begin(); defer { scope.end() } |
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 | |
| import MediaPlayer | |
| extension Notification.Name { | |
| static let systemVolumeDidChange = Notification.Name( | |
| rawValue: "AVSystemController_SystemVolumeDidChangeNotification" | |
| ) | |
| } | |
| class ViewController: UIViewController { |
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
| private final class OSUnfairLock { | |
| private let pointer: os_unfair_lock_t | |
| init() { | |
| self.pointer = .allocate(capacity: 1) | |
| self.pointer.initialize(to: os_unfair_lock()) | |
| } | |
| deinit { | |
| self.pointer.deinitialize(count: 1) |
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
| // umbrella.h | |
| #pragma once | |
| @import Foundation; | |
| #include "../yoga/Yoga.h" | |
| #include "../yoga/YGMacros.h" | |
| #include "../yoga/YGValue.h" | |
| #include "../yoga/YGEnums.h" |
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 CoreHaptics | |
| protocol HapticFeedback { | |
| func generateFeedback() | |
| } | |
| final class Haptic: HapticFeedback { | |
| private let generator: HapticFeedback | |
| init() { |