Created
July 6, 2014 05:10
-
-
Save tonyarnold/78bee7dd76557cdef69f to your computer and use it in GitHub Desktop.
Originally proposed and provided by Rob Rix allows you to append values from an NSArray to a Swift array, so long as they match the Swift array's expected element type.
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 | |
@assignment func += <T:AnyObject> (inout array: T[], cocoaArray: NSArray) { | |
array.extend( | |
map(cocoaArray) { | |
$0 as T | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment