-
1943年
- 6月1日 起工
- 8月31日 命名
- 10月10日 進水
-
1944年
- 1月25日 竣工(本籍:呉鎮守府
-
呉鎮守府警備海防艦
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
| struct YesIterator<Value>: IteratorProtocol { | |
| private var value: Value | |
| private var count: Int | |
| init(value: Value, count: Int) { | |
| self.value = value | |
| self.count = count | |
| } | |
| mutating func next() -> Value? { | |
| guard count > 1 else { return nil } |
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 typealias StringIMP = @convention(c) (AnyObject, Selector) -> NSString | |
| private let stringSelector = #selector(getter: NSAttributedString.string) | |
| private var stringIMP: StringIMP? | |
| extension NSAttributedString { | |
| private var stringImp: StringIMP { | |
| if let i = stringIMP { return i } |
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
| @dynamicMemberLookup | |
| struct Point { | |
| var cgPoint: CGPoint | |
| subscript(dynamicMember keyPath: WritableKeyPath<CGPoint, CGFloat>) -> Float { | |
| get { Float(cgPoint[keyPath: keyPath]) } | |
| set(value) { cgPoint[keyPath: keyPath] = CGFloat(value) } | |
| } | |
| } |
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 Cocoa | |
| import Combine | |
| public protocol ActionPerfomer: AnyObject { | |
| var target: AnyObject? { get set } | |
| var action: Selector? { get set } | |
| } | |
| extension NSControl: ActionPerfomer {} |
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 ommit(_ pType: NSPasteboard.PasteboardType) -> Bool { | |
| let a = [ | |
| "rtf", | |
| "NeXT", | |
| "HTML", | |
| "Web" | |
| ] | |
| let r = pType.rawValue.lowercased() |
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
| enum IfResult<T> { | |
| case `false` | |
| case value(T) | |
| @discardableResult | |
| func elseIf(_ condition: @autoclosure () -> Bool, _ f: () -> T) -> IfResult { | |
| switch self { | |
| case .false: return condition() ? .value(f()) : .false | |
| default: return self | |
| } |
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 split<Element>(_ array: [Element], _ n: Int) -> [ArraySlice<Element>] { | |
| func g(_ array: ArraySlice<Element>, _ n: Int) -> [ArraySlice<Element>] { | |
| let a = array.prefix(n) | |
| guard a.count != 0 else { return [] } | |
| return [a] + g(array.dropFirst(n), n) | |
| } | |
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 fizzBuzz1(_ n: Int) -> String { | |
| switch (n.isMultiple(of: 3), n.isMultiple(of: 5)) { | |
| case (true, true): return "FizzBuzz" | |
| case (true, false): return "Fizz" | |
| case (false, true): return "Buzz" | |
| default: return "\(n)" | |
| } | |
| } |
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 Result { | |
| @discardableResult | |
| func ifFailure(_ f: (Failure) -> Void) -> Result { | |
| if case let .failure(e) = self { f(e) } | |
| return self | |
| } | |
| } | |
| extension Result where Failure: OptionSet, Failure == Failure.Element { |