This file contains 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
/// Usage: phoneTextField.formatPattern(pattern: "(***) ***-**-**", replacementChar: "*", staticPrefixString: "+7 ", allowText: false, allowNumbers: true) | |
extension UITextField { | |
/// Структура с перечислениями не хранимых полей | |
private struct FieldMaskProperties { | |
static var pattern = "pattern" | |
static var replacementChar = "replacementChar" |
This file contains 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
/// Timer that can work in background and update timer count if needed even if app resign active | |
class RepeatingTimer { | |
fileprivate enum State { | |
case suspended | |
case resumed | |
} | |
let timeInterval: TimeInterval | |
This file contains 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
/// Cascade delete object in Realm | |
/// | |
/// - warning: Call only in write transaction | |
/// - Parameters: | |
/// - object: Object to delete | |
/// - realm: Realm instance | |
/// - onlyProperties: removeOnly property (ex. before re-write/update model) | |
func cascadeDelete(_ object: Object, with realm: Realm, onlyProperties: Bool = false) { | |