Skip to content

Protocol attached to Optional and NSNull which allows developers to check if an object is nil or not. This is good when working with type of Any like in Mirror, or Dictionaries where optional and NSNull types can be stored in Any

License

Notifications You must be signed in to change notification settings

TheAngryDarling/SwiftNillable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nillable

swift >= 4.0 macOS Linux Apache 2

Protocol attached to Optional and NSNull which allows developers to check if an object is nil or not. This is good when working with type of Any like in Mirror, or Dictionaries where optional and NSNull types can be stored in Any

Usage

let properties: [String: Any] = [...]
for (k,v) in properties {
    if let vO = v as? Nillable, !vO.isRootNil  {
        //Get the root value, escaping all optionals
        let rValue = vO.unsafeRootUnwrap
    }
}

Authors

License

This project is licensed under Apache License v2.0 - see the LICENSE.md file for details

About

Protocol attached to Optional and NSNull which allows developers to check if an object is nil or not. This is good when working with type of Any like in Mirror, or Dictionaries where optional and NSNull types can be stored in Any

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages