GithubHelp home page GithubHelp logo

abouttoday's Introduction

For trying "Async/await"

Async/await

Completion Handler(Call back)을 사용하는 것보다 가독성이 향상됨. Error Handle이 가능하게 됨

Version iOS 15.0 부터 많이 사용되는(?) async 관련 API 지원, 하지만 여전히 많은 API Completion을 통하여 처리. iOS 13.0(Xcode 13.2)이상 15.0 미만 Version과 Async/await 지원하지 않는 API에서 Async/await을 사용하기위해 Continuation 사용 필요

await withCheckedContinuation { continuation in
    reqeustImageSynchronous(with: fetchedPhotosAsset[index], size: size) { image in
        continuation.resume(returning: image)
    }
}

Unit Test, about Task Task { } 테스트하는데 있어서 Combine을 사용해서 다음과 같이 진행했지만, 좋은 방법인지 의문

class TodayPresenterSpy {
     
    @Published var presentWeatherCalled = false

    func presentWeather(response: AboutToday.TodayWeather.Fetched.Response) {
        presentWeatherCalled = true
    }
}

func test_loadWeather_whenGiveCurrentLocation_shouldCallPresenter() {
    ///given
    sut.presenter = todayPresenterSpy
        
    let promise = expectation(description: "Presenter Be Called")
    todayPresenterSpy.$presentWeatherCalled
        .sink { isCalled in
            if isCalled {
                promise.fulfill()
            }
        }
        .store(in: &cancellableBag)
    ///when
    sut.loadWeather()
    wait(for: [promise], timeout: 1)
    ///then
    XCTAssert(todayPresenterSpy.presentWeatherCalled)
}

Performance Async/await이 Suspend를 통하여, (즉, Thread Control을 System이 맡아중요도에 따라 처리하는 방법) Async를 처리하는 것이, GCD보다 퍼포먼스 측면에서 얼마나 유용한지 이해 부족

Directory List

├── AboutToday
│   ├── Resources
│   │   └── Assets.xcassets
│   │       ├── AccentColor.colorset
│   │       │   └── Contents.json
│   │       ├── AppIcon.appiconset
│   │       │   └── Contents.json
│   │       └── Contents.json
│   ├── Sources
│   │   ├── Entries
│   │   │   ├── AppDelegate.swift
│   │   │   ├── SceneDIContainer.swift
│   │   │   └── SceneDelegate.swift
│   │   ├── Models
│   │   │   └── Weather.swift
│   │   ├── Repositories
│   │   │   ├── PhotosRepository.swift
│   │   │   ├── WeatherIconRepository.swift
│   │   │   └── WeatherRepository.swift
│   │   ├── Scenes
│   │   │   ├── Map
│   │   │   │   ├── Annotations
│   │   │   │   │   └── PhotoAnnotation.swift
│   │   │   │   ├── DetailMapPresenter.swift
│   │   │   │   ├── DetailMapRouter.swift
│   │   │   │   ├── DetailMapViewController.swift
│   │   │   │   ├── DetailMapnteractor.swift
│   │   │   │   └── ViewModels
│   │   │   │       └── PhotosLocation.swift
│   │   │   ├── Today
│   │   │   │   ├── TodayInteractor.swift
│   │   │   │   ├── TodayPresenter.swift
│   │   │   │   ├── TodayRouter.swift
│   │   │   │   ├── TodayViewController.swift
│   │   │   │   ├── ViewModels
│   │   │   │   │   ├── ListPhotoImages.swift
│   │   │   │   │   └── WeatherViewModel.swift
│   │   │   │   └── Views
│   │   │   │       ├── Cells
│   │   │   │       │   └── TodayPhotoCell.swift
│   │   │   │       ├── CurrentLocationView.swift
│   │   │   │       ├── LocationErrorView.swift
│   │   │   │       ├── TodayView.swift
│   │   │   │       └── TodayWeatherView.swift
│   │   │   ├── ViewController.swift
│   │   │   └── Weather Detail
│   │   │       ├── ViewModels
│   │   │       │   └── WeatherDetail.swift
│   │   │       ├── Views
│   │   │       │   └── WeatherDetailView.swift
│   │   │       ├── WeatherDetailInteractor.swift
│   │   │       ├── WeatherDetailPresenter.swift
│   │   │       ├── WeatherDetailRouter.swift
│   │   │       └── WeatherDetailViewController.swift
│   │   ├── Service
│   │   │   ├── Network
│   │   │   │   ├── APIEndpoints.swift
│   │   │   │   ├── Endpoint.swift
│   │   │   │   ├── NetworkAPIConfiguration.swift
│   │   │   │   ├── NetworkDataCodableService.swift
│   │   │   │   ├── NetworkService.swift
│   │   │   │   └── Requester.swift
│   │   │   └── Photos
│   │   │       └── PhotosService.swift
│   │   ├── Utils
│   │   │   ├── Extensions
│   │   │   │   ├── UIColor+Gradient.swift
│   │   │   │   ├── UIVIew+Corner Radius.swift
│   │   │   │   └── UIView+Border.swift
│   │   │   └── UIViewPreview.swift
│   │   └── Workers
│   │       ├── PhotosWorker.swift
│   │       └── WeatherWorker.swift
│   └── Supportings
│       ├── Base.lproj
│       │   └── LaunchScreen.storyboard
│       ├── ConfidentialKey.xcconfig
│       ├── Info.plist
│       └── ar.lproj
│           └── LaunchScreen.strings
├── AboutToday.xcodeproj
│   ├── project.pbxproj
│   ├── project.xcworkspace
│   │   ├── contents.xcworkspacedata
│   │   ├── xcshareddata
│   │   │   ├── IDEWorkspaceChecks.plist
│   │   │   └── swiftpm
│   │   │       ├── Package.resolved
│   │   │       └── configuration
│   │   └── xcuserdata
│   │       └── doyoung.xcuserdatad
│   │           └── UserInterfaceState.xcuserstate
│   ├── xcshareddata
│   │   └── xcschemes
│   │       ├── AboutToday - arabic.xcscheme
│   │       └── AboutToday.xcscheme
│   └── xcuserdata
│       └── doyoung.xcuserdatad
│           ├── xcdebugger
│           │   └── Breakpoints_v2.xcbkptlist
│           └── xcschemes
│               └── xcschememanagement.plist
├── AboutTodayTests
│   ├── Network
│   │   ├── NetworkCodableServiceTests.swift
│   │   └── NetworkServiceTests.swift
│   ├── Scenes
│   │   ├── DetailMap
│   │   │   ├── DetailMapInteractor.swift
│   │   │   ├── DetailMapPresenterTests.swift
│   │   │   └── DetailViewControllerTests.swift
│   │   ├── Today
│   │   │   ├── TodayInteractorTests.swift
│   │   │   ├── TodayPresenterTests.swift
│   │   │   └── TodayViewControllerTests.swift
│   │   └── WeatherDetail
│   │       ├── WeatherDetailInteractorTests.swift
│   │       ├── WeatherDetailPresenterTests.swift
│   │       └── WeatherDetailViewControllerTests.swift
│   ├── Seeds.swift
│   └── Worker
│       └── WeatherWorkerTests.swift
├── AboutTodayUITests
│   ├── AboutTodayUITests.swift
│   └── AboutTodayUITestsLaunchTests.swift
└── README.md

abouttoday's People

Contributors

idoyoung avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.