Skip to content

Instantly share code, notes, and snippets.

@TWS001
Last active December 13, 2015 20:08
Show Gist options
  • Save TWS001/4967613 to your computer and use it in GitHub Desktop.
Save TWS001/4967613 to your computer and use it in GitHub Desktop.
iOSSnippets
CorePlotMagicalRecord
// Im Wesentlichen Coreplot stack aufsetzten. schreiben von Records und Lesen
MagicalRecord.setupCoreDataStackWithAutoMigratingSqliteStoreNamed("myMagicTest.sqlite")
var localContext : NSManagedObjectContext = NSManagedObjectContext.MR_contextForCurrentThread()
var newValue : XYValues = XYValues.MR_createInContext(localContext) as XYValues
newValue.xValue = 0.0
newValue.yValue = 9.9
localContext.MR_saveOnlySelfAndWait()
newValue = XYValues.MR_createInContext(localContext) as XYValues
newValue.xValue = 2.0
newValue.yValue = 11.9
localContext.MR_saveOnlySelfAndWait()
newValue = XYValues.MR_createInContext(localContext) as XYValues
newValue.xValue = 3.0
newValue.yValue = 12.9
println("\n Test \(newValue.xValue!) \n")
localContext.MR_saveOnlySelfAndWait()
var alleValues : Array = XYValues.MR_findAll()
println("\n Grösse des Array: \(alleValues.count) \n")
let res1 = alleValues[2].xValue!
let res2 = alleValues[4].xValue!
println("\n Ein Wert 0: \(alleValues[0].xValue!) \n")
println("\n Ein Wert 1: \(alleValues[1].xValue!) \n")
println("\n Ein Wert 2: \(alleValues[2].xValue!!.doubleValue) \n")
println("\n Multiplikation: \(res1!.doubleValue * res2!.doubleValue) \n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment