Avatar
norio_nomura 5/23/2018 7:59 AM
@swift-4.1.3 import Foundation protocol Bar { static func decode(string: String) -> Self? } extension NSRegularExpression: Bar { static func decode(string: String) -> Self? { return try? .init(pattern: string, options: .caseInsensitive) } } let bar = NSRegularExpression.decode(string: ".*") print(bar! is Bar) (edited)