- Add "UI-Testing" to
launchArguments
before launching the app under test - On launch, check for the argument in
AppDelegate.swift
- If it exists remove everything for the app's domain from
NSUserDefaults
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
#import <WebKit/WebKit.h> | |
@interface WKUserContentController (Spec) | |
- (NSDictionary *)userScriptHandlers; | |
@end |
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
import XCTest | |
class UITests: XCTestCase { | |
let app = XCUIApplication() | |
override func setUp() { | |
super.setUp() | |
continueAfterFailure = false | |
app.launch() | |
} |
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
protocol URLSessionDataTaskProtocol { | |
func resume() | |
} | |
extension NSURLSessionDataTask: URLSessionDataTaskProtocol { } |
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
//: Playground - noun: a place where people can play | |
enum Error: ErrorType { | |
case ParsingError | |
} | |
struct Person { | |
let name: String | |
let age: Int |
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
//: Playground - noun: a place where people can play | |
struct Option { | |
var id: UInt | |
var name: String | |
} | |
func combine(options: [Option]) -> [UInt: String] { | |
var combinedOptions = [UInt: String]() | |
for option in options { |
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
import XCTest | |
class TestCase: XCTestCase { | |
let app = XCUIApplication() | |
override func setUp() { | |
super.setUp() | |
continueAfterFailure = false | |
app.launchArguments = ["UI-Testing"] |
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
. |
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
import CoreLocation | |
struct AddressFormatter { | |
private let placemark: Placemarkable | |
init(placemark: Placemarkable) { | |
self.placemark = placemark | |
} | |
func formattedAddress() -> String { |
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
. |