pattern matching operator
-
Swift Tips & Tricks) Pattern matching operator ~=Swift/Tips & Tricks 2021. 10. 12. 00:45
Pattern matching operator ~= 어떤 값이 어떠한 범위에 포함되어있는지에 대해서 조건을 입력할 때는 보통 if 문 안에 conditions 두개를 && 로 연결해서 사용했었는데요, if number >= 0 && number Void) { guard let url = URL(string: "someURL") else { print("cannot create url") return } var request = URLRequest(url: url) request.httpMethod = "GET" URLSession.shared.dataTask(with: request) { data, response, error in guard error == nil else { print("Error: ..