Mercurial > public > lazybear
comparison LazyBear/Persistence.swift @ 465:6953d83060a4
New design
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sat, 17 Jul 2021 17:58:57 +0100 |
parents | 783b567800d9 |
children |
comparison
equal
deleted
inserted
replaced
464:04e430ef254a | 465:6953d83060a4 |
---|---|
14 let result = PersistenceController(inMemory: true) | 14 let result = PersistenceController(inMemory: true) |
15 let viewContext = result.container.viewContext | 15 let viewContext = result.container.viewContext |
16 for _ in 0..<10 { | 16 for _ in 0..<10 { |
17 let newItem = Item(context: viewContext) | 17 let newItem = Item(context: viewContext) |
18 newItem.timestamp = Date() | 18 newItem.timestamp = Date() |
19 } | |
20 | |
21 for _ in 0..<10 { | |
22 let company = Company(context: viewContext) | |
23 company.symbol = "AAPL" | |
24 company.companyName = "Apple Inc" | |
19 } | 25 } |
20 do { | 26 do { |
21 try viewContext.save() | 27 try viewContext.save() |
22 } catch { | 28 } catch { |
23 // Replace this implementation with code to handle the error appropriately. | 29 // Replace this implementation with code to handle the error appropriately. |