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
// NSRegularExpression+Split.swift | |
// | |
// Verbatim ObjC->Swift port originating from https://github.com/bendytree/Objective-C-RegEx-Categories | |
extension NSRegularExpression { | |
func split(_ str: String) -> [String] { | |
let range = NSRange(location: 0, length: str.characters.count) | |
//get locations of matches |
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 String { | |
func isCapitalized() -> Bool { | |
guard self.characters.count > 0 else { | |
return false | |
} | |
return (CharacterSet.uppercaseLetters as NSCharacterSet).characterIsMember(String(self.characters.first!).utf16[String.UTF16Index(0)]); | |
} | |
} | |
// Test |
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 | |
/// Data Manager error types. | |
/// | |
/// - noData: No valid data was received. | |
/// - parsingFailure: The data parsing failed. | |
/// - endpointFailure: The endpoint failed. | |
/// - invalidInput: The input was invalid. | |
/// - anyError: Generic wrapped error. | |
enum DataError: Error { |
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
/// Interface representing an optionally nil value type. | |
protocol OptionalType: ExpressibleByNilLiteral { | |
/// The boxed optional type. | |
associatedtype Wrapped | |
} | |
extension Optional: OptionalType {} | |
// Example |
OlderNewer