이제 마지막으로 테스트 코드를 작성해 본다. moya 에서 제공하는 customEndpointClosure를 쓰면 별다른 조건 없이 샘플 데이터가 들어오는 것 처럼 동작 시킬 수 있다. func testExample() throws { let disposeBag = DisposeBag() //async 테스트를 위해 expectation 작성 let expectation = XCTestExpectation() //moya에서 제공해주는 라이브러리로 실제 서버가 아닌 커스텀 엔드포인트를 만드는 과정이다. let customEndpointClosure = { (target: JokeAPI) -> Endpoint in return Endpoint(url: URL(target: target).absoluteSt..
두 가지 방법이 있는데, 첫 번째는 swift 에서 제공하는 await, async 를 사용한다. 아래의 예시를 보면 함수에 async 로 작성하고 함수에 await로 작성하였다. func testDownloadWebDataWithConcurrency() async throws { // Create a URL for a webpage to download. let url = URL(string: "https://apple.com")! // Use an asynchronous function to download the webpage. let dataAndResponse: (data: Data, response: URLResponse) = try await URLSession.shared.data(from..
- Total
- Today
- Yesterday
- ATS failed system trust
- Moya
- xcode whitespace trim option
- CI/CD
- 같이쓰기
- swift
- jenkins
- 프로그래머스
- 무료는 아니지만
- AppThinning
- swiftLint
- IF (KAKAO) DEV 2022
- chatgpt 4o
- 코테
- 모듏화
- geohash
- ChatGPT
- Fastlane
- ios
- XCTestExpectation
- Default Rules
- 빌드자동화
- GCD
- bitrise
- MQTT
- firebase
- async
- GPT4
- AWS IoT
- RxSwift
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |