A [term]_method is like a function; you will learn more about them later.
A [term]_method_ is like a function; you will learn more about them later.
A [term]_method is like a function; you will learn more about them later.
A [term]_method is like a function; you will learn more about them later.
A [term]_method_ is like a function; you will learn more about them later.
A [term]_method is like a function; you will learn more about them later.
import UIKit | |
import ObjectiveC.runtime | |
// MARK: - IOKit | |
@objc private protocol IOHIDEvent: NSObjectProtocol {} | |
private struct IOHIDDigitizerEventMask: OptionSet { | |
let rawValue: UInt32 | |
init(rawValue: UInt32) { self.rawValue = rawValue } |
import UIKit | |
class DoneAccessoryView: UIInputView { | |
private let toolbar = UIToolbar() | |
init() { | |
super.init(frame: .zero, inputViewStyle: .default) | |
translatesAutoresizingMaskIntoConstraints = false | |
allowsSelfSizing = true |
import UIKit | |
private class CardPresenter: UIPresentationController { | |
private let dimmingView = UIView() | |
private let roundingView = UIView() | |
// MARK: - | |
override init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?) { |
{ | |
si = ( | |
{ | |
a = "-0.3427528387535028"; | |
i = 0; | |
o = 1; | |
z = "270.9334057827345"; | |
}, | |
{ | |
a = "-10.23975864472505"; |
import Photos | |
private extension Collection where Element == URLQueryItem { | |
subscript(_ name: String) -> String? { | |
return first { $0.name == name }?.value | |
} | |
} |
import Foundation | |
struct Test { | |
var a: String? | |
var b: Int? | |
var c: NSObject? | |
var x = 42 | |
enum Error: Swift.Error { |
import Foundation | |
private func loadCSymbol<T>(named name: String, of _: T.Type = T.self) -> T { | |
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2) | |
guard let sym = dlsym(RTLD_DEFAULT, name) else { preconditionFailure(String(cString: dlerror())) } | |
return unsafeBitCast(sym, to: T.self) | |
} | |
private let CC_SHA1_DIGEST_LENGTH = 20 | |
private let CC_SHA1: @convention(c) (UnsafeRawPointer, Int32, UnsafeMutablePointer<UInt8>) -> UnsafeMutablePointer<UInt8> = loadCSymbol(named: "CC_SHA1") |
#import <Foundation/Foundation.h> | |
typedef void(^SomeBlock)(void); | |
@interface Foo: NSObject | |
// If this one isn't marked `_Nonnull`, a caller of the class | |
// won't warn. | |
- (void)doAThingWithCompletionHandler:(_Nonnull SomeBlock)handler; |
import Foundation | |
// Stolen from https://github.com/ole/whats-new-in-swift-4/blob/master/Whats-new-in-Swift-4.playground/Pages/Encoding%20and%20decoding.xcplaygroundpage/Contents.swift#L14-L31 | |
struct Card: Codable, Equatable { | |
enum Suit: String, Codable { | |
case clubs, spades, hearts, diamonds | |
} | |
enum Rank: Int, Codable { | |
case two = 2, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace |