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 Foundation | |
| import Combine | |
| let publisher = ["A", "B", "C", "D"].publisher | |
| publisher | |
| .contains("C") | |
| .sink { | |
| print($0) // true | |
| } |
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 Foundation | |
| extension Date { | |
| static func randomBetween(start: String, end: String, format: String = "yyyy-MM-dd") -> String { | |
| let date1 = Date.parse(start, format: format) | |
| let date2 = Date.parse(end, format: format) | |
| return Date.randomBetween(start: date1, end: date2).dateString(format) | |
| } |
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
| // | |
| // ContentView.swift | |
| // TryGeometryReader | |
| // | |
| // Created by satoutakeshi on 2019/12/07. | |
| // Copyright © 2019 satoutakeshi. Licensed under MIT. | |
| // | |
| import SwiftUI |
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
| SIGN_IN_WITH_APPLE: | |
| - de: Mit Apple anmelden | |
| - he: התחברות באמצעות Apple | |
| - en_AU: Sign in with Apple | |
| - ar: تسجيل الدخول باستخدام Apple | |
| - el: Σύνδεση μέσω Apple | |
| - ja: Appleでサインイン | |
| - en: Sign in with Apple | |
| - uk: Увійти з Apple | |
| - es_419: Iniciar sesión con Apple |
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
| func test_should_display_error_message_for_missing_required_fields() { | |
| let app = XCUIApplication() | |
| continueAfterFailure = false | |
| let loginPageObject = LoginPageObject(app: app) | |
| app.launch() | |
| let usernameTextField = loginPageObject.usernameTextField | |
| usernameTextField.tap() | |
| usernameTextField.typeText("") |
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 Foundation | |
| import XCTest | |
| class LoginPageObject { | |
| var app: XCUIApplication | |
| init(app: XCUIApplication) { | |
| self.app = app | |
| } |
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
| func test_should_display_error_message_for_missing_required_fields() { | |
| let app = XCUIApplication() | |
| continueAfterFailure = false | |
| app.launch() | |
| let usernameTextField = app.textFields["usernameTextField"] | |
| usernameTextField.tap() | |
| usernameTextField.typeText("") | |
| let passwordTextField = app.textFields["passwordTextField"] |
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
| // View | |
| var body: some View { | |
| TextField("User name", text: $loginVM.username) | |
| .accessibilityIdentifier("usernameTextField") | |
| } | |
| // UI Testing Mapping | |
| let usernameTextField = app.textFields["usernameTextField"] | |
| usernameTextField.tap() | |
| usernameTextField.typeText("") |
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 UITableView { | |
| func register(_ type: UITableViewCell.Type) { | |
| let className = String(describing: type) | |
| register(UINib(nibName: className, bundle: nil), forCellReuseIdentifier: className) | |
| } | |
| func dequeueReusableCell<T>(_ type: T.Type) -> T? { | |
| let className = String(describing: type) | |
| return dequeueReusableCell(withIdentifier: className) as? T |
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
| // Register Cell | |
| tableView.register(UINib(nibName: "MyCell", bundle: nil), forCellReuseIdentifier: "MyCell") | |
| // Dequeue Cell | |
| let cell = tableView.dequeueReusableCell(withIdentifier: "MyCell") as! MyCell |