You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Swiftx is a Swift library containing functional abstractions and extensions to
the Swift Standard Library. Swiftx is a smaller and simpler way to introduce pure functional
datatypes into any codebase.
Seamless interaction with existing platform libraries is also possible with
minimal effort:
import Foundation
importstruct Swiftx.Result
/// result now contains either an array of file paths or the error generated by `NSFileManager`.
letresult:Result<[String]>=from({ ep inletdocumentsDirectory:String=(NSSearchPathForDirectoriesInDomains(.DocumentDirectory,.UserDomainMask,true)[0]asString)return(NSFileManager.defaultManager().contentsOfDirectoryAtPath(documentsDirectory, error: ep)as[String]?)??[]})
Swiftx can even help with expressions of nothingness or errors:
import Swiftx
/// We may not be able to do what we said we'd do, but this definition compiles. At runtime,
/// any code that invokes this function will immediately halt the program.
func provePEqualsNP()->Proof<P,NP>{returnundefined()}
System Requirements
Swiftx supports OS X 10.9+ and iOS 8.0+.
License
Swiftx is released under the BSD license.
About
Functional data types and functions for any project