The goal is to make the codebase more approachable to first-time contributors by adopting Swift Structured Concurrency. The result from this refactor will be more readable business logic and a net-decrease in LOCs.
OBAKit API change
Before
// Keep track of operation
var operation: DecodableOperation<RESTAPIResponse<StopArrivals>>?
deinit {
operation?.cancel()
}
func loadData() {
let op = apiService.getArrivalsAndDeparturesForStop(
id: stopID,
minutesBefore: minutesBefore,
minutesAfter: minutesAfter
)
op.complete { [weak self] result in
guard let self else { return }
switch (result) {
case .failure(let error):
// Show error in UI
case .success(let response):
// Show arrivals in UI
}
self.operation = op
}
This is part-one of Concurrency adoption. Lots of bandaids and deprecation warnings are present, but I want to keep PRs reasonably sized.
Deprecate RESTAPIService (renamed to _RESTAPIService), which uses Operations and replaces it with RESTAPIService, which uses Swift Structured Concurrency.
The goal is to make the codebase more approachable to first-time contributors by adopting Swift Structured Concurrency. The result from this refactor will be more readable business logic and a net-decrease in LOCs.
OBAKit API change
Before
After
This is part-one of Concurrency adoption. Lots of bandaids and deprecation warnings are present, but I want to keep PRs reasonably sized.
RESTAPIService
(renamed to_RESTAPIService
), which uses Operations and replaces it withRESTAPIService
, which uses Swift Structured Concurrency.