★ Get Application
let app = XCUIApplication()★ accessibilityIdentifier by code
| 0x5063Ea9d67FB408faff44CA1dd8DDDd0FfDEd269 |
Swift3.0
public extension DispatchQueue {
private static var _onceTracker = [String]()
public class func once(file: String = #file, function: String = #function, line: Int = #line, block:(Void)->Void) {
let token = file + ":" + function + ":" + String(line)
once(token: token, block: block)| print("Movies by C. Columbus only:") | |
| for case let Media.movie(title, director, year) in mediaList where director == "Chris Columbus" { | |
| print(" - \(title) (\(year))") | |
| } | |
| /* Output: | |
| Movies by C. Columbus only: | |
| - Harry Potter and the Philosopher's Stone (2001) | |
| - Harry Potter and the Chamber of Secrets (2002) | |
| */ |
| enum Media { | |
| case book(title: String, author: String, year: Int) | |
| case movie(title: String, director: String, year: Int) | |
| case website(urlString: String) | |
| } | |
| let mediaList: [Media] = [ | |
| .book(title: "Harry Potter and the Philosopher's Stone", author: "J.K. Rowling", year: 1997), | |
| .movie(title: "Harry Potter and the Philosopher's Stone", director: "Chris Columbus", year: 2001), | |
| .book(title: "Harry Potter and the Chamber of Secrets", author: "J.K. Rowling", year: 1999), |