Created
June 25, 2017 09:08
-
-
Save tjeerdintveen/7d8f6d177a85a503a94e84018e72e25e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Weave possible nsnull values to turn them into a nil. | |
func convertNSNullToNil<T>(_ data: T?) -> T? { | |
switch data { | |
case is NSNull: return nil | |
case is [NSNull]: return nil | |
case is [NSNull: Any]: return nil | |
default: return data | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment