プロトコルMisc
CustomStringConvertible description オブジェクトの文字表示 print
CustomDebugStringConvertible debugDescription オブジェクトの文字表示 debugPrint
LosslessStringConvertible 文字列からそのままオブジェクト構築できる
TextOutputStream write(_ string: String)
TextOutputStreamable writeの拡張 write
Hashable ハッシュ。ハッシュが違えば違う。ハッシュが同じでもおなじとは限らない。
Comparable 比較
Equatable 同じ
BitwiseOperations ビット計算できる
AnyObject 任意のオブジェクト
Error エラー
OptionSet ビットでつかっている。SetAlgebra, RawRepresentable。使うと便利かも?
AnyHashable構造体
任意のHashableなものなら受け入れる引数等を作りたいときにつかう。いわゆるtype-erased。
標準入力から一行受け取る。trueはその一行は標準入力から切り出すかを示す。
public func readLine(strippingNewline: Bool = default) -> String?
コマンドライン
public enum CommandLine { public static var argc: Int32 { get } // argvの値 public static var unsafeArgv: UnsafeMutablePointer<UnsafeMutablePointer<Int8>?> { get } // swift用に変換される?のか? public static var arguments: [String] }
Unmanaged構造体
自分でメモリ管理するもの
強参照のチェック
isKnownUniquelyReferenced
一個だけから強参照されているかを見る。weakに複数参照されていてもOK。
blog.stablekernel.com