A Perfect Swift Framework. All the Extensions.
MasterKit is a frameowork wrapper.
import MasterKit
When you import it, it automatically imports these packages:
You can also choose to import these packages individually.
Let's you conform your enums to many new raw value types:
import MasterKit
// or import ExpressibleEnum
// Bool
enum BoolEnum: Bool {
case `true` = true
case `false` = false
}
// Array
case ArrayEnum: [Int] {
case foo = "[1, 2, 3, 4]"
}
// MultidimensionalArrays
case NDEnum: [[[[[[[[[[Int]]]]]]]]]] {
case foo = "[[[[[[[[[[0]]]]]]]]]]"
}
// Enum can also conform to Self
// Example 1: Enum A Conforms to A?
enum A: A?, Enum { case foo }
enum B: Self?, Enum { case foo }
// Example 2: Raw Values = Self?
enum C: C?, Enum { case foo = "foo" }
XCTAssert(C.foo == .foo)
XCTAssert(C.foo.rawValue! == .foo)
XCTAssert(C.foo.rawValue!.rawValue! == .foo)
XCTAssert(C.foo == C.foo.rawValue)
XCTAssert(C.foo == C.foo.rawValue?.rawValue?.rawValue?.rawValue)
// Example 3: Oscillating Raw Values
enum D: D?, Enum {
case bar = "bas"
case bas = "bar"
}
XCTAssert(D.bar == D.bas.rawValue)
XCTAssert(D.bar != .bar.rawValue!)
XCTAssert(D.bar == .bar.rawValue?.rawValue)
Enums will now be able to conform to:
I've also added protocols to these tpyes, for recursive purposes:
Create a reference on any Swift value (Even structs!)
import MasterKit
// or import ReferenceKit
func testReference() {
var foo = 1
@Reference var this = &foo
this += 1
assert(foo != 1)
assert(foo == 2)
}
Added a Regex wrapper object. It's totally optional to use, though.
Important Features:
link |
Stars: 0 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics