Skip to content

Instantly share code, notes, and snippets.

@fxm90 fxm90/isset.swift
Last active Apr 23, 2017

What would you like to do?
Equivalent of php "isset()" in swift 3.0
func isset(_ args: Any?...) -> Bool {
return !args.contains { $0 == nil }

This comment has been minimized.

Copy link
Owner Author

fxm90 commented Apr 23, 2017

Would evaluate to true
print(isset("a", 1, 2, true, false))

Would evaluate to false due to nil value
print(isset("a", 1, 2, true, false, nil))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.