SWIFT AND THE BIG DATA
A collaborative use case
Carlos Alonso
http://mrcalonso.com
@calonso
• Carlos Alonso
• Software Engineer at MyDrive
Solutions
• iOS developer since 2.1 (=~ 2009)
• Swift since the very first day
• http://mrcalonso.com
• @calonso
Volume Velocity
Variety Veracity
Big Data Value
COLLABORATIVE MODEL
Big Data
START RECORDING!
MEMORY
• CSVDumpable: Background synchronised data dumping to
disk.
• Instruments
• http://engineering.mydrivesolutions.com/posts/swift_data_coll
ection/
init(filename: String!) {
file = NSTemporaryDirectory().stringByAppendingPathComponent("(filename).csv")
os = NSOutputStream(toFileAtPath: file, append: false)!
os.open()
super.init()
}
func addRow(row: CSVRepresentable) {
if let rowData = row.toCSV().
dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) {
let bytes = UnsafePointer<UInt8>(rowData.bytes)
lock.lock()
os.write(bytes, maxLength: rowData.length)
lock.unlock()
}
}
PERFORMANCE
• NSOperationQueue.
• Release build optimisations.
• Beware concatenating strings!
• Instruments
IOS STUFF
• Background modes.
• Operation Queues.
• Sensors:
• Accelerometer
• DeviceMotion API
• GPS
• …
STILL RUNNING?
– Carlos Alonso
“Push back your ego, strive for simplicity.”
BIG THANKS!
http://mrcalonso.com
@calonso

Swift and the BigData