Convert to a Swift Package Manager package and modernize the codebase - #1
Open
EmadBeyrami wants to merge 3 commits into
Open
Convert to a Swift Package Manager package and modernize the codebase#1EmadBeyrami wants to merge 3 commits into
EmadBeyrami wants to merge 3 commits into
Conversation
- Add Package.swift with two library products (Timerable, RxTimerable) and move sources into the standard Sources/<target> layout. - Bump the RxSwift dependency to 6.10.2 and use the current RxSwift/ RxCocoa APIs. - Mark the public API surface `public` (protocols, models, TimeCounter, TimeBuilder) — previously everything was internal, so the library couldn't actually be consumed from another module. - Fix a crash-on-deinit when a TimeCounter is deallocated before setTimer(time:) is called. - Replace the Foundation `%@` String(format:) formatting with plain string interpolation, replace the `Sequence where Self == [T]` constraint with `Array where Element == T`, and clean up naming (backgroundForegroundTimelapse, matching file headers). - Add TimerType: Equatable and basic unit tests for both targets. - Add a Swift/Xcode .gitignore and rewrite the README with SPM installation instructions and updated version badges.
…w AsyncTimerable target - Sources/Timerable/TimeCounter+Async.swift: adds TimeCounter.start(with:) -> AsyncStream<TimeModel> on top of the existing closure-based API, so `bind`/`timerDidEnd` and `for await` can be used interchangeably. - New AsyncTimerable target: a from-scratch Concurrency-native implementation (Task-based ticking, AsyncStream<TimeModel>, NotificationCenter.notifications(named:) for background/foreground correction instead of the observer pattern) — no closures, no RxSwift. Same Timerable/TimeDecreasing/TimeIncreasing shape as the other targets. - Wire the new target into Package.swift as a third library product with its own test target, and bump the package's platform floor to iOS 15/tvOS 15 (required by NotificationCenter's async sequence API). - Document both async paths in the README.
Example/TimerableExample.xcodeproj is a SwiftUI app with one tab per API: closures (Timerable), the AsyncStream wrapper on Timerable, RxTimerable, and the Concurrency-native AsyncTimerable. It links to this repo as a local Swift Package (path: ..), so it always builds against the current source, not a tagged release. The example app targets iOS 16 (for NavigationStack) even though the package itself only requires iOS 15 — a consumer's deployment target can be higher than the library's floor. Document the example in the README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
and move sources into the standard Sources/ layout.
RxCocoa APIs.
public(protocols, models, TimeCounter,TimeBuilder) — previously everything was internal, so the library
couldn't actually be consumed from another module.
setTimer(time:) is called.
%@String(format:) formatting with plainstring interpolation, replace the
Sequence where Self == [T]constraint with
Array where Element == T, and clean up naming(backgroundForegroundTimelapse, matching file headers).
installation instructions and updated version badges.