새소식

iOS/Swift

[Swift] URLComponent

  • -

URLComponent


- URL의 scheme값을 추가 할 때 사용

 

var componentsURL = URLComponents(string: addressTextField.text!)

     componentsURL?.path = "접속 주소 이후 값"

     componentsURL?.queryItems = [

            URLQueryItem(name: "userid", value: userID),

            URLQueryItem(name: "userpw", value: userPW)
     ]             

let requestURL = URL(string: (componentsURL?.string!)!)
728x90

'iOS > Swift' 카테고리의 다른 글

[Swift] 클로저  (0) 2022.12.24
[Swift] 다른 앱 실행시키기  (0) 2022.12.04
[Swift] URLSession https 인증서 신뢰  (0) 2022.11.20
[Swift] URLSession  (0) 2022.11.17
[Swift] Codable vs JSONSerialization  (1) 2022.10.15
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.