Swiftpack.co -  mborsten/AfterX as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
mborsten/AfterX
AfterX helps you keep track of things you only want to do once, or after x amount of times, during the application lifetime
.package(url: "https://github.com/mborsten/AfterX.git", from: "1.6.3")

AfterX

Version License Platform

AfterX uses the UserDefaults to keep track of tasks you have performed before. It keeps track of the tasks using the task identifier you give.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

When you want to do something only once during the lifetime of the app:

  AfterX.doOnce(task: "button_hint") {
    self.showHint()
  }

When you want to do something once after the user has performed a task an x amount of times:

  func calledWhenSucceedingTask() {

    ...
    
    AfterX.do(task: "ask_for_review", after: 5) {
      self.askForReview()
    }
  }

You can reset the count for a task:

  AfterX.resetCount("my_task")

Or reset the count for all tasks:

  AfterX.resetAll()

Requirements

Installation

AfterX is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "AfterX"

Author

Marcel Borsten, marcel@impart.nl

License

AfterX is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 1
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

0.3.2
4 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API