/RockStar

A high level iOS framework with a swifty API

Primary LanguageSwiftMIT LicenseMIT

Rockstar

Version License

RockStar is a Swift framework for frontend programming in iOS 10+, macOS 10.12+ and Linux.

RockStar is split up into a few modules:

  • Services
  • Reactivity
  • Helpers
    • NSURLSession services
    • Logging
    • Runtime analytics
    • Testing
<!-- - [NSURLSession services](docs/services/url-session.md)
- [Logging](docs/services/logging.md)
- [Runtime Analytics](docs/services/runtime-analytics.md) -->

Example

index.map { index in
    return pages[index]
}.bind(to: pageView.renderedPage) // Changes the rendered page when the index changes

navBar.next.onClick.then { index += 1 } // These operators also works on bindings
navBar.previous.onClick.then { index -= 1}

index.reduceMap(==, pages.count) // `true` for the last page
    .map(!) // `!lastPage``{"data":[]}
    .bind(to: navBar.next, atKeyPath: \.isUserInteractionEnabled) // disables on last page

index.reduceMap(==, 0) // `true` for the first page
    .map(!)
    .bind(to: navBar.previous, atKeyPath: \.isUserInteractionEnabled)

// new > old == forward
index.changeMap(>).map { forward -> AnimationDirection in
    if forward {
        return .rightToLeft
    } else {
        return .leftToRight
    }
}.then(currentPage.reload) // takes the animation direction as argument

Installation

Rockstar is available through CocoaPods and Swift Package Manager.

Rockstar is in Alpha now, it will be developed a lot before a stable API has been achieved. If you'd like to use Rockstar it's recommended to lock to minor versions for now.

pod 'Rockstar'

or

.package(url: "https://github.com/RockStarSwift/RockStar.git", from: "0.3.0")