Skip to content

Instantly share code, notes, and snippets.

View yunustek's full-sized avatar
🏠
Working from home

Yunus Tek yunustek

🏠
Working from home
View GitHub Profile
pod 'EarlGrey'
app.buttons["nameButton"].tap()
// Bir metin alanına text eklemek de benzer şekildedir:
let textField = app.textFields["Username"]
textField.tap()
textField.typeText("<text to write>")
let goLabel = app.staticTexts["Go!"]
let exists = NSPredicate(format: "exists == true")
expectation(for: exists, evaluatedWithObject: goLabel, handler: nil)
@yunustek
yunustek / ViewController.swift
Created October 7, 2018 17:08
UITest Metinin Görüntülendiğini test etmek
XCTAssert(app.staticTexts["Welcome"].exists)
@yunustek
yunustek / ViewController.swift
Created October 7, 2018 17:04
Adjusting Image Sizes For Accessibility
imageView.adjustsImageSizeForAccessibilityContentSizeCategory = true
@yunustek
yunustek / ViewController.swift
Created October 7, 2018 17:00
View Controller Canlılığını Kontrol Etme networkRequest
networkRequest.fetchData() { [weak self] result in
guard let self = self else { return }
switch result {
case .Succeeded(let data):
self.processData(data)
case .Failed(let err):
self.handleError(err)
}
@yunustek
yunustek / ViewController.swift
Created October 7, 2018 16:59
View Controller Canlılığını Kontrol Etme
DispatchQueue.main.async { [weak self] in
guard let self = self else {
return
}
// Do stuff with self, knowing it is held strongly after the guard statement
}
@yunustek
yunustek / ViewController.swift
Created October 7, 2018 16:58
Boolean Toggling
var bools = [true, false]
bools[0].toggle()
//bools == [false, false]
@yunustek
yunustek / ViewController.swift
Created October 7, 2018 16:57
Removing Elements from Collection
var numbers = [5, 6, 7, 8, 9, 10, 11]
numbers.removeAll(where: { $0 % 2 == 1 })
// numbers == [6, 8, 10]
@yunustek
yunustek / ViewController.swift
Created October 7, 2018 16:57
Testing Sequence Elements
let names = ["Sofia", "Camilla", "Martina", "Mateo", "Nicolás"]
let allHaveAtLeastFive = names.allSatisfy({ $0.count >= 5 })
// allHaveAtLeastFive == true