Skip to content

Instantly share code, notes, and snippets.

@seyitcodeit
seyitcodeit / BuilderImplementation.swift
Last active July 6, 2021 18:43
Builder implementation for Article
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let builder = Builder()
let viewController = builder.makeNewsViewController()
let navigationController = UINavigationController(rootViewController:viewController)
@seyitcodeit
seyitcodeit / Builder.swift
Last active July 6, 2021 18:46
Builder Pattern example for Medium Post
struct Builder {
func makeNewsViewController() -> UIViewController {
let cameraProvider = CameraDataProvider()
let commentorProvider = CommentorDataProvider()
let moderatorProvider = ModeratorDataProvider()
let tableProvider = TableDataProvider()
let useCase = MyUseCase(
@seyitcodeit
seyitcodeit / loginTest.swift
Last active December 24, 2020 09:10
Xcode Test Login
func testLogin() {
continueAfterFailure = false
app = XCUIApplication()
app.launch()
wait(for: 2)
passLoginSalesForce()
wait(for: 5)
// after your login you cand add some methods here according to your app flow
}
@seyitcodeit
seyitcodeit / waitExtension.swift
Created December 24, 2020 09:04
Xcode Waiting Extension
extension XCTestCase {
func wait(for duration: TimeInterval) {
let waitExpectation = expectation(description: "Waiting")
let when = DispatchTime.now() + duration
DispatchQueue.main.asyncAfter(deadline: when) {
waitExpectation.fulfill()
}
// I use a buffer here to avoid flakiness with Timer on CI
waitForExpectations(timeout: duration + 0.5)
@seyitcodeit
seyitcodeit / coordinateShooting.swift
Last active December 24, 2020 08:59
Xcode Tests Coordinate Shooting
//username typing..
let textFieldVector = CGVector(dx: 247, dy: 436)
let textFieldCoordinate = app.coordinate(withNormalizedOffset: .zero).withOffset(textFieldVector)
textFieldCoordinate.tap()
app.typeText("your salesforce username")