Skip to content

RxSwift do notation using Swift Concurrency async/await syntax

Notifications You must be signed in to change notification settings

sudopark/RxSwift-do-notation

Repository files navigation

RxSwift-do-extension

RxSwift do notation using Swift Concurrency async/await syntax

func loadHighestPriceItemInfo() -> Maybe<HighestPriceItemInfo> {
    
    return storeService.highestPriceItemID()
        .flatMap { itemID in
            guard var item = try await storeService.loadItem(itemID).value,
                  let seller = try await userService.loadUser(item.sellerID).value
            else {
                throw ...
            }
            item.convertedPrice = try await priceConverter.convertPrice(item.price, to: "BTC").value
            return HighestPriceItemInfo(item, seller)
        }
}

About

RxSwift do notation using Swift Concurrency async/await syntax

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages