Last active
October 5, 2019 02:13
-
-
Save chrismsimpson/22d535b710a01dfab4666c7b26927b2f to your computer and use it in GitHub Desktop.
Collection extensions for Swift
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
import Foundation | |
extension Collection { | |
public var nonEmpty: Self? { | |
guard !self.isEmpty else { | |
return nil | |
} | |
return self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment