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
@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: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 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 17:04
Adjusting Image Sizes For Accessibility
imageView.adjustsImageSizeForAccessibilityContentSizeCategory = true
@yunustek
yunustek / ViewController.swift
Created October 7, 2018 17:08
UITest Metinin Görüntülendiğini test etmek
XCTAssert(app.staticTexts["Welcome"].exists)
let goLabel = app.staticTexts["Go!"]
let exists = NSPredicate(format: "exists == true")
expectation(for: exists, evaluatedWithObject: goLabel, handler: nil)
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>")
pod 'EarlGrey'
import EarlGrey
class MyFirstEarlGreyTest: XCTestCase {
func testExample() {
// Test aksiyonlarınız burada olacak
}
}
func testExample() {
EarlGrey.selectElement(with: grey_keyWindow())
.assert(grey_sufficientlyVisible())
}