Swift Package Index


Porting CRToast in Swift, with some new features


  • The latest stable release is 0.1.2. Released over 1 year ago.
  • The last commit to master was over 1 year ago.

Swift Version Compatibility

  • 0.1.2 and master
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 0.1.2 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

CRToastSwift

Origins

I've always like the care and effort put into CRToast. The documentation and the concepts are complete over there, so make sure to read it first.

Again, go read the documentation over there.

How to use in a project

Right now, no Cocoapods or Carthage support because I wanted to see if I could get by with using only Swift Package Manager.

To include in your project, use a git submodule, then generate the project using swift package generate-xcodeproj, and include that as a dependency. Don't forget to add it to your target dependencies, your link phase, and your copy phase.

Porting to Swift

A lot of the porting effort was put into the very different way of handling types. Objective-C's lax rules regarding types made checking values and using "similar but not equal" types of values was rejected wholesale by the Swift compiler.

Feel free to compare the two repositories and see the differences. I have tried to keep as much as possible of the original structure and naming conventions.

The Extra Bit

Because I'm fascinated with obscure iOS features that seem too powerful to be true, I have decided to include a new "dynamic" type of notification: you set it up with UIView objects that mean something to the alert text, and when the notification falls down, it will rebound on them, highlighting what the user probably didn't read in the text.

For instance, say you have a standard login view, with two text fields and a check box to agree to the TOS. If the user leaves an important item empty (login, password, or checkbox), the alert will collide with it on its way out, but pass through the ones that are correctly filled.

example