Created
August 8, 2016 18:43
-
-
Save jpmcglone/ac7dd90f1f67009b5ca95e3f6d6c7001 to your computer and use it in GitHub Desktop.
Array extension: prepend
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 Array { | |
mutating func prepend(newElement: Element) { | |
self.insert(newElement, atIndex: 0) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment