Basically here is what you need to do:
- Archive your array to file on MAC; and do it in Swift code!
- Add this file to your app's main bundle on MAC
- Unarchive file from the app's main bundle on iOS
The tricky part is that you need to do all this automatically.
1. Archive your array to file on MAC and do it in Swift code!
Create Swift script that generates archive with array. First parameter of the script will accept App main bundle folder location(it will be passed at the second step). Add CreatePointsArrayArchive.swift file to your project, and do not add it to any targets.
Contents of CreatePointsArrayArchive.swift:
import Foundation
import Cocoa
println("MY APP: Generating points array archive...")
let archiveFileName = "MyPointsArray.archive"
let resourcesFolderPath = Process.arguments[1] // access first element because 0 contains this script file name
// YOUR CODE:
let pnt1 = CGPointMake(0, 33)
let pnt2 = CGPointMake(33, 66)
let pnt3 = CGPointMake(47, 71)
let pnt4 = CGPointMake(66, 65)
let pnt5 = CGPointMake(79, 69)
let pnt6 = CGPointMake(90, 67)
let pnt7 = CGPointMake(116, 36)
let pnt8 = CGPointMake(93, 8)
let pnt9 = CGPointMake(59, 0)
let pnt10 = CGPointMake(37, 0)
var pntz = NSMutableArray()
pntz.addObject(NSValue(point: pnt1))
pntz.addObject(NSValue(point: pnt2))
pntz.addObject(NSValue(point: pnt3))
pntz.addObject(NSValue(point: pnt4))
pntz.addObject(NSValue(point: pnt5))
pntz.addObject(NSValue(point: pnt6))
pntz.addObject(NSValue(point: pnt7))
pntz.addObject(NSValue(point: pnt8))
pntz.addObject(NSValue(point: pnt9))
pntz.addObject(NSValue(point: pnt10))
// Archiving array to file
if NSKeyedArchiver.archiveRootObject(pntz, toFile: archiveFileName) {
println(" Array points archive generated SUCCESSFULY wit hfile name '\(archiveFileName)'.")
} else {
println(" FAILED to generate array points archive.")
}
// Copy file to app budle
println("MY APP: Copying '\(archiveFileName)' to app main bundle at path '\(resourcesFolderPath)'...")
var err: NSError?
if NSFileManager.defaultManager().copyItemAtPath(archiveFileName, toPath: resourcesFolderPath + archiveFileName, error: &err) {
println(" '\(archiveFileName)' file added to app main bundle.")
} else {
println(" FAILED to add '\(archiveFileName)' to app main bundle.")
}
... so afteer 1-st step there is CreatePointsArrayArchive.swift file at the root folder of the project; with the code that listed above.
2. Add this file to your app's main bundle on MAC
You need to perform this as a build step. Here is what you need to do:
Open you project build target and Run Script phase:

Type following line in script text area:
xcrun swift -sdk $(xcrun --show-sdk-path --sdk macosx) CreatePointsArrayArchive.swift ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/
... screenshot:

3. Unarchive file from the app's main bundle on iOS
To access you archive in iOS App use code bellow:
// NOTE: MyPointsArray.archive is name of the file that was defined in CreatePointsArrayArchive.swift file
let pointsArchivePath = NSBundle.mainBundle().pathForResource("MyPointsArray", ofType: "archive")
let pointsArr = NSKeyedUnarchiver.unarchiveObjectWithFile(archivePath) as NSArray