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
| // | |
| // Combine+WithLatestFrom.swift | |
| // | |
| // Created by Shai Mishali on 29/08/2019. | |
| // Copyright © 2019 Shai Mishali. All rights reserved. | |
| // | |
| import Combine | |
| // MARK: - Operator methods |
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 PlaygroundSupport | |
| import Foundation | |
| class Worker { | |
| private let queue = DispatchQueue.global(qos: .background) | |
| private let serialQueue = DispatchQueue(label: "com.acme.serial") | |
| public private(set) var count = 0 | |
| func incrementCount() { |
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 isValidEmail() -> Bool { | |
| guard !self.lowercaseString.hasPrefix("mailto:") else { return false } | |
| guard let emailDetector = try? NSDataDetector(types: NSTextCheckingType.Link.rawValue) else { return false } | |
| let matches = emailDetector.matchesInString(self, options: NSMatchingOptions.Anchored, range: NSRange(location: 0, length: self.characters.count)) | |
| guard matches.count == 1 else { return false } | |
| return matches[0].URL?.scheme == "mailto" | |
| } | |
| } |
NewerOlder