├── .gitignore ├── LICENSE ├── README.md ├── TutorialAppGroup ├── Shared │ ├── CoreDataStorage.swift │ ├── Counter+CoreDataProperties.swift │ └── Counter.swift ├── TutorialAppGroup Today Extension │ ├── Base.lproj │ │ └── MainInterface.storyboard │ ├── Info.plist │ ├── TodayViewController.swift │ └── TutorialAppGroup Today Extension.entitlements ├── TutorialAppGroup WatchKit 1 App │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ └── Interface.storyboard │ ├── Info.plist │ └── TutorialAppGroup WatchKit 1 App.entitlements ├── TutorialAppGroup WatchKit 1 Extension │ ├── Assets.xcassets │ │ └── README__ignoredByTemplate__ │ ├── Info.plist │ ├── InterfaceController.swift │ └── TutorialAppGroup WatchKit 1 Extension.entitlements ├── TutorialAppGroup.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── TutorialAppGroup │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── TutorialAppGroup.entitlements │ ├── TutorialAppGroup.xcdatamodeld │ ├── .xccurrentversion │ └── TutorialAppGroup.xcdatamodel │ │ └── contents │ └── ViewController.swift └── screenshots ├── 1.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | 28 | # Carthage 29 | # 30 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 31 | # Carthage/Checkouts 32 | 33 | Carthage/Build 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Maxim Bilan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOS Shared CoreData Storage for App Groups 2 | 3 | Sometimes iOS applications have some extensions, for example Today Extensions, or Apple Watch Extensions. And sometimes no sense to implement a data storage for the every target. In this post I tell how to create one data storage for iOS application and his extensions. 4 | 5 | First of all you need to create app groups for your application. Go to Apple Developer Member Center and register app group. Fill the description and identifier and follow the instructions. 6 | 7 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/1.png) 8 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/2.png) 9 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/3.png) 10 | 11 | After that when you will create an identifier for an application or an extension, don’t forget enable the service App Groups. 12 | 13 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/4.png) 14 | 15 | Then go to the application or the extension and edit services. It’s really simple, see the next screenshots: 16 | 17 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/5.png) 18 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/6.png) 19 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/7.png) 20 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/8.png) 21 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/9.png) 22 | 23 | And please, perform this procedure for all extensions of the group. It’s all settings, now open the Xcode and let’s go to write code. 24 | 25 | In the Xcode for the each target enable App Groups in target settings. 26 | 27 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/10.png) 28 | 29 | Use Core Data Storage class. Implementation of this class see below: 30 | 31 |
 32 | import Foundation
 33 | import CoreData
 34 | 
 35 | public class CoreDataStorage {
 36 | 	
 37 | 	// MARK: - Shared Instance
 38 | 	
 39 | 	class var sharedInstance : CoreDataStorage {
 40 | 		struct Static {
 41 | 			static var onceToken: dispatch_once_t = 0
 42 | 			static var instance: CoreDataStorage? = nil
 43 | 		}
 44 | 		dispatch_once(&Static.onceToken) {
 45 | 			Static.instance = CoreDataStorage()
 46 | 		}
 47 | 		return Static.instance!
 48 | 	}
 49 | 	
 50 | 	// MARK: - Initialization
 51 | 	
 52 | 	init() {
 53 | 		NSNotificationCenter.defaultCenter().addObserver(self, selector: "contextDidSavePrivateQueueContext:", name: NSManagedObjectContextDidSaveNotification, object: self.privateQueueCtxt)
 54 | 		NSNotificationCenter.defaultCenter().addObserver(self, selector: "contextDidSaveMainQueueContext:", name: NSManagedObjectContextDidSaveNotification, object: self.mainQueueCtxt)
 55 | 	}
 56 | 	
 57 | 	deinit {
 58 | 		NSNotificationCenter.defaultCenter().removeObserver(self)
 59 | 	}
 60 | 	
 61 | 	// MARK: - Notifications
 62 | 	
 63 | 	@objc func contextDidSavePrivateQueueContext(notification: NSNotification) {
 64 | 		if let context = self.mainQueueCtxt {
 65 | 			self.synced(self, closure: { () -> () in
 66 | 				context.performBlock({() -> Void in
 67 | 					context.mergeChangesFromContextDidSaveNotification(notification)
 68 | 				})
 69 | 			})
 70 | 		}
 71 | 	}
 72 | 	
 73 | 	@objc func contextDidSaveMainQueueContext(notification: NSNotification) {
 74 | 		if let context = self.privateQueueCtxt {
 75 | 			self.synced(self, closure: { () -> () in
 76 | 				context.performBlock({() -> Void in
 77 | 					context.mergeChangesFromContextDidSaveNotification(notification)
 78 | 				})
 79 | 			})
 80 | 		}
 81 | 	}
 82 | 	
 83 | 	func synced(lock: AnyObject, closure: () -> ()) {
 84 | 		objc_sync_enter(lock)
 85 | 		closure()
 86 | 		objc_sync_exit(lock)
 87 | 	}
 88 | 	
 89 | 	// MARK: - Core Data stack
 90 | 	
 91 | 	lazy var applicationDocumentsDirectory: NSURL = {
 92 | 		// The directory the application uses to store the Core Data store file. This code uses a directory named 'Bundle identifier' in the application's documents Application Support directory.
 93 | 		let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
 94 | 		return urls[urls.count-1]
 95 | 		}()
 96 | 	
 97 | 	lazy var managedObjectModel: NSManagedObjectModel = {
 98 | 		// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
 99 | 		let modelURL = NSBundle.mainBundle().URLForResource("TutorialAppGroup", withExtension: "momd")!
100 | 		return NSManagedObjectModel(contentsOfURL: modelURL)!
101 | 		}()
102 | 	
103 | 	lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = {
104 | 		// The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
105 | 		// Create the coordinator and store
106 | 		var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
107 | 		
108 | 		let directory = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier("group.com.maximbilan.tutorialappgroup")!
109 | 		
110 | 		let url = directory.URLByAppendingPathComponent("TutorialAppGroup.sqlite")
111 | 		
112 | 		do {
113 | 			try coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil)
114 | 		} catch var error as NSError {
115 | 			coordinator = nil
116 | 			NSLog("Unresolved error \(error), \(error.userInfo)")
117 | 			abort()
118 | 		} catch {
119 | 			fatalError()
120 | 		}
121 | 		print("\(coordinator?.persistentStores)")
122 | 		return coordinator
123 | 		}()
124 | 	
125 | 	// MARK: - NSManagedObject Contexts
126 | 	
127 | 	public class func mainQueueContext() -> NSManagedObjectContext {
128 | 		return self.sharedInstance.mainQueueCtxt!
129 | 	}
130 | 	
131 | 	public class func privateQueueContext() -> NSManagedObjectContext {
132 | 		return self.sharedInstance.privateQueueCtxt!
133 | 	}
134 | 	
135 | 	lazy var mainQueueCtxt: NSManagedObjectContext? = {
136 | 		// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail.
137 | 		var managedObjectContext = NSManagedObjectContext(concurrencyType:.MainQueueConcurrencyType)
138 | 		managedObjectContext.persistentStoreCoordinator = self.persistentStoreCoordinator
139 | 		return managedObjectContext
140 | 		}()
141 | 	
142 | 	lazy var privateQueueCtxt: NSManagedObjectContext? = {
143 | 		// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail.
144 | 		var managedObjectContext = NSManagedObjectContext(concurrencyType:.PrivateQueueConcurrencyType)
145 | 		managedObjectContext.persistentStoreCoordinator = self.persistentStoreCoordinator
146 | 		return managedObjectContext
147 | 		}()
148 | 	
149 | 	// MARK: - Core Data Saving support
150 | 	
151 | 	public class func saveContext(context: NSManagedObjectContext?) {
152 | 		if let moc = context {
153 | 			if moc.hasChanges {
154 | 				do {
155 | 					try moc.save()
156 | 				} catch {
157 | 				}
158 | 			}
159 | 		}
160 | 	}
161 | 	
162 | }
163 | 
164 | extension NSManagedObject {
165 | 	
166 | 	public class func findAllForEntity(entityName: String, context: NSManagedObjectContext) -> [AnyObject]? {
167 | 		let request = NSFetchRequest(entityName: entityName)
168 | 		let result: [AnyObject]?
169 | 		do {
170 | 			result = try context.executeFetchRequest(request)
171 | 		} catch let error as NSError {
172 | 			print(error)
173 | 			result = nil
174 | 		}
175 | 		return result
176 | 	}
177 | }
178 | 
179 | 180 | CoreData class for working with your shared storage, also NSManagedObject extension for fetching data from the entity. 181 | 182 | I provide samples for iOS application, Today Extension and WatchKit app. See the screenshots: 183 | 184 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/11.png) 185 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/12.png) 186 | ![alt tag](https://raw.github.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/master/screenshots/13.png) 187 | 188 | You need to create a context and CoreData object: 189 | 190 |
191 | let context = CoreDataStorage.mainQueueContext()
192 | var counter: Counter?
193 | 
194 | 195 | For fetching data please use the following code: 196 | 197 |
198 | func fetchData() {
199 | 	self.context.performBlockAndWait{ () -> Void in
200 | 		let counter = NSManagedObject.findAllForEntity("Counter", context: self.context)
201 | 		if (counter?.last != nil) {
202 | 			self.counter = (counter?.last as! Counter)
203 | 		}
204 | 		else {
205 | 			self.counter = (NSEntityDescription.insertNewObjectForEntityForName("Counter", inManagedObjectContext: self.context) as! Counter)
206 | 			self.counter?.title = "Counter"
207 | 			self.counter?.value = 0
208 | 		}
209 | 		
210 | 		self.updateUI()
211 | 	}
212 | }
213 | 
214 | 215 | For saving a context: 216 | 217 |
218 | CoreDataStorage.saveContext(self.context)
219 | 
220 | 221 | The full code you can find in this repository. Please feel free. Happy coding! 222 | 223 | NOTE: In watchOS 2 and higher you should have to maintain two separate data stores. The group identifier is not working in this case. If either side is a "read-only" client and the CoreData datastore is small and changes infrequently you could potentially use the transferFile WatchConnectivity API to transfer the whole store each time it changes. 224 | -------------------------------------------------------------------------------- /TutorialAppGroup/Shared/CoreDataStorage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CoreDataStorage.swift 3 | // TutorialAppGroup 4 | // 5 | // Created by Maxim on 10/18/15. 6 | // Copyright © 2015 Maxim. All rights reserved. 7 | // 8 | 9 | import CoreData 10 | 11 | open class CoreDataStorage { 12 | 13 | // MARK: - Shared Instance 14 | 15 | public static let sharedInstance = CoreDataStorage() 16 | 17 | // MARK: - Initialization 18 | 19 | init() { 20 | NotificationCenter.default.addObserver(self, selector: #selector(contextDidSavePrivateQueueContext(_:)), name: NSNotification.Name.NSManagedObjectContextDidSave, object: self.privateQueueCtxt) 21 | NotificationCenter.default.addObserver(self, selector: #selector(contextDidSaveMainQueueContext(_:)), name: NSNotification.Name.NSManagedObjectContextDidSave, object: self.mainQueueCtxt) 22 | } 23 | 24 | deinit { 25 | NotificationCenter.default.removeObserver(self) 26 | } 27 | 28 | // MARK: - Notifications 29 | 30 | @objc func contextDidSavePrivateQueueContext(_ notification: Notification) { 31 | if let context = self.mainQueueCtxt { 32 | self.synced(self, closure: { () -> () in 33 | context.perform({() -> Void in 34 | context.mergeChanges(fromContextDidSave: notification) 35 | }) 36 | }) 37 | } 38 | } 39 | 40 | @objc func contextDidSaveMainQueueContext(_ notification: Notification) { 41 | if let context = self.privateQueueCtxt { 42 | self.synced(self, closure: { () -> () in 43 | context.perform({() -> Void in 44 | context.mergeChanges(fromContextDidSave: notification) 45 | }) 46 | }) 47 | } 48 | } 49 | 50 | func synced(_ lock: AnyObject, closure: () -> ()) { 51 | objc_sync_enter(lock) 52 | closure() 53 | objc_sync_exit(lock) 54 | } 55 | 56 | // MARK: - Core Data stack 57 | 58 | lazy var applicationDocumentsDirectory: URL = { 59 | // The directory the application uses to store the Core Data store file. This code uses a directory named 'Bundle identifier' in the application's documents Application Support directory. 60 | let urls = Foundation.FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) 61 | return urls[urls.count-1] 62 | }() 63 | 64 | lazy var managedObjectModel: NSManagedObjectModel = { 65 | // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model. 66 | let modelURL = Bundle.main.url(forResource: "TutorialAppGroup", withExtension: "momd")! 67 | return NSManagedObjectModel(contentsOf: modelURL)! 68 | }() 69 | 70 | lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = { 71 | // The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. 72 | // Create the coordinator and store 73 | var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel) 74 | let options = [ 75 | NSMigratePersistentStoresAutomaticallyOption: true, 76 | NSInferMappingModelAutomaticallyOption: true 77 | ] 78 | let directory = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.maximbilan.tutorialappgroup")! 79 | let url = directory.appendingPathComponent("TutorialAppGroup.sqlite") 80 | do { 81 | try coordinator!.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: options) 82 | } catch var error as NSError { 83 | coordinator = nil 84 | NSLog("Unresolved error \(error), \(error.userInfo)") 85 | abort() 86 | } catch { 87 | fatalError() 88 | } 89 | return coordinator 90 | }() 91 | 92 | // MARK: - NSManagedObject Contexts 93 | 94 | open class func mainQueueContext() -> NSManagedObjectContext { 95 | return self.sharedInstance.mainQueueCtxt! 96 | } 97 | 98 | open class func privateQueueContext() -> NSManagedObjectContext { 99 | return self.sharedInstance.privateQueueCtxt! 100 | } 101 | 102 | lazy var mainQueueCtxt: NSManagedObjectContext? = { 103 | // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail. 104 | var managedObjectContext = NSManagedObjectContext(concurrencyType:.mainQueueConcurrencyType) 105 | managedObjectContext.persistentStoreCoordinator = self.persistentStoreCoordinator 106 | return managedObjectContext 107 | }() 108 | 109 | lazy var privateQueueCtxt: NSManagedObjectContext? = { 110 | // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail. 111 | var managedObjectContext = NSManagedObjectContext(concurrencyType:.privateQueueConcurrencyType) 112 | managedObjectContext.persistentStoreCoordinator = self.persistentStoreCoordinator 113 | return managedObjectContext 114 | }() 115 | 116 | // MARK: - Core Data Saving support 117 | 118 | open class func saveContext(_ context: NSManagedObjectContext?) { 119 | if let moc = context { 120 | if moc.hasChanges { 121 | do { 122 | try moc.save() 123 | } catch { 124 | } 125 | } 126 | } 127 | } 128 | 129 | } 130 | extension NSManagedObject { 131 | 132 | public class func findAllForEntity(_ entityName: String, context: NSManagedObjectContext) -> [AnyObject]? { 133 | let request = NSFetchRequest(entityName: entityName) 134 | let result: [AnyObject]? 135 | do { 136 | result = try context.fetch(request) 137 | } catch let error as NSError { 138 | print(error) 139 | result = nil 140 | } 141 | return result 142 | } 143 | 144 | } 145 | -------------------------------------------------------------------------------- /TutorialAppGroup/Shared/Counter+CoreDataProperties.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Counter+CoreDataProperties.swift 3 | // TutorialAppGroup 4 | // 5 | // Created by Maxim on 10/18/15. 6 | // Copyright © 2015 Maxim. All rights reserved. 7 | // 8 | // Choose "Create NSManagedObject Subclass…" from the Core Data editor menu 9 | // to delete and recreate this implementation file for your updated model. 10 | // 11 | 12 | import Foundation 13 | import CoreData 14 | 15 | extension Counter { 16 | 17 | @NSManaged var value: NSNumber? 18 | @NSManaged var title: String? 19 | 20 | } 21 | -------------------------------------------------------------------------------- /TutorialAppGroup/Shared/Counter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Counter.swift 3 | // TutorialAppGroup 4 | // 5 | // Created by Maxim on 10/18/15. 6 | // Copyright © 2015 Maxim. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreData 11 | 12 | class Counter: NSManagedObject { 13 | 14 | // Insert code here to add functionality to your managed object subclass 15 | 16 | } 17 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup Today Extension/Base.lproj/MainInterface.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 38 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup Today Extension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Tutorial App Group Today Extension 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSExtension 26 | 27 | NSExtensionMainStoryboard 28 | MainInterface 29 | NSExtensionPointIdentifier 30 | com.apple.widget-extension 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup Today Extension/TodayViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodayViewController.swift 3 | // Tutorial App Group Today Extension 4 | // 5 | // Created by Maxim on 10/18/15. 6 | // Copyright © 2015 Maxim. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import NotificationCenter 11 | import CoreData 12 | 13 | class TodayViewController: UIViewController, NCWidgetProviding { 14 | 15 | @IBOutlet weak var titleLabel: UILabel! 16 | @IBOutlet weak var valueLabel: UILabel! 17 | @IBOutlet weak var incrementButton: UIButton! 18 | 19 | let context = CoreDataStorage.mainQueueContext() 20 | var counter: Counter? 21 | 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | 25 | self.preferredContentSize.height = 50 26 | 27 | fetchData() 28 | } 29 | 30 | func widgetPerformUpdateWithCompletionHandler(completionHandler: ((NCUpdateResult) -> Void)) { 31 | // Perform any setup necessary in order to update the view. 32 | 33 | // If an error is encountered, use NCUpdateResult.Failed 34 | // If there's no update required, use NCUpdateResult.NoData 35 | // If there's an update, use NCUpdateResult.NewData 36 | 37 | fetchData() 38 | completionHandler(NCUpdateResult.newData) 39 | } 40 | 41 | // MARK: - Logic 42 | 43 | func fetchData() { 44 | self.context.performAndWait{ () -> Void in 45 | 46 | let counter = NSManagedObject.findAllForEntity("Counter", context: self.context) 47 | 48 | if (counter?.last != nil) { 49 | self.counter = (counter?.last as! Counter) 50 | } 51 | else { 52 | self.counter = (NSEntityDescription.insertNewObject(forEntityName: "Counter", into: self.context) as! Counter) 53 | self.counter?.title = "Counter" 54 | self.counter?.value = 0 55 | } 56 | 57 | self.updateUI() 58 | } 59 | } 60 | 61 | func updateUI() { 62 | titleLabel.text = counter?.title 63 | valueLabel.text = counter?.value?.stringValue 64 | } 65 | 66 | func save() { 67 | if let value = Int(self.valueLabel.text!) { 68 | self.counter?.value = value as NSNumber? 69 | CoreDataStorage.saveContext(self.context) 70 | } 71 | } 72 | 73 | // MARK: - Actions 74 | 75 | @IBAction func incrementButtonAction(_ sender: UIButton) { 76 | if let value = Int(self.valueLabel.text!) { 77 | counter?.value = (value + 1) as NSNumber? 78 | } 79 | 80 | updateUI() 81 | save() 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup Today Extension/TutorialAppGroup Today Extension.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.com.maximbilan.tutorialappgroup 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup WatchKit 1 App/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "24x24", 5 | "idiom" : "watch", 6 | "scale" : "2x", 7 | "role" : "notificationCenter", 8 | "subtype" : "38mm" 9 | }, 10 | { 11 | "size" : "27.5x27.5", 12 | "idiom" : "watch", 13 | "scale" : "2x", 14 | "role" : "notificationCenter", 15 | "subtype" : "42mm" 16 | }, 17 | { 18 | "size" : "29x29", 19 | "idiom" : "watch", 20 | "role" : "companionSettings", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "size" : "29x29", 25 | "idiom" : "watch", 26 | "role" : "companionSettings", 27 | "scale" : "3x" 28 | }, 29 | { 30 | "size" : "40x40", 31 | "idiom" : "watch", 32 | "scale" : "2x", 33 | "role" : "appLauncher", 34 | "subtype" : "38mm" 35 | }, 36 | { 37 | "size" : "44x44", 38 | "idiom" : "watch", 39 | "scale" : "2x", 40 | "role" : "appLauncher", 41 | "subtype" : "40mm" 42 | }, 43 | { 44 | "size" : "50x50", 45 | "idiom" : "watch", 46 | "scale" : "2x", 47 | "role" : "appLauncher", 48 | "subtype" : "44mm" 49 | }, 50 | { 51 | "size" : "86x86", 52 | "idiom" : "watch", 53 | "scale" : "2x", 54 | "role" : "quickLook", 55 | "subtype" : "38mm" 56 | }, 57 | { 58 | "size" : "98x98", 59 | "idiom" : "watch", 60 | "scale" : "2x", 61 | "role" : "quickLook", 62 | "subtype" : "42mm" 63 | }, 64 | { 65 | "size" : "108x108", 66 | "idiom" : "watch", 67 | "scale" : "2x", 68 | "role" : "quickLook", 69 | "subtype" : "44mm" 70 | }, 71 | { 72 | "idiom" : "watch-marketing", 73 | "size" : "1024x1024", 74 | "scale" : "1x" 75 | }, 76 | { 77 | "size" : "44x44", 78 | "idiom" : "watch", 79 | "scale" : "2x", 80 | "role" : "longLook", 81 | "subtype" : "42mm" 82 | } 83 | ], 84 | "info" : { 85 | "version" : 1, 86 | "author" : "xcode" 87 | } 88 | } -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup WatchKit 1 App/Base.lproj/Interface.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup WatchKit 1 App/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | TutorialAppGroup 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | UISupportedInterfaceOrientations 26 | 27 | UIInterfaceOrientationPortrait 28 | UIInterfaceOrientationPortraitUpsideDown 29 | 30 | WKCompanionAppBundleIdentifier 31 | com.maximbilan.tutorialappgroup 32 | WKWatchKitApp 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup WatchKit 1 App/TutorialAppGroup WatchKit 1 App.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.com.maximbilan.tutorialappgroup 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup WatchKit 1 Extension/Assets.xcassets/README__ignoredByTemplate__: -------------------------------------------------------------------------------- 1 | Did you know that git does not support storing empty directories? 2 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup WatchKit 1 Extension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | TutorialAppGroup WatchKit 1 Extension 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSExtension 26 | 27 | NSExtensionAttributes 28 | 29 | WKAppBundleIdentifier 30 | com.maximbilan.tutorialappgroup.watchkitapp 31 | 32 | NSExtensionPointIdentifier 33 | com.apple.watchkit 34 | 35 | RemoteInterfacePrincipalClass 36 | $(PRODUCT_MODULE_NAME).InterfaceController 37 | 38 | 39 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup WatchKit 1 Extension/InterfaceController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InterfaceController.swift 3 | // TutorialAppGroup WatchKit 1 Extension 4 | // 5 | // Created by Maxim on 10/18/15. 6 | // Copyright © 2015 Maxim. All rights reserved. 7 | // 8 | 9 | import WatchKit 10 | import Foundation 11 | import CoreData 12 | 13 | class InterfaceController: WKInterfaceController { 14 | 15 | @IBOutlet var titleLabel: WKInterfaceLabel! 16 | @IBOutlet var valueLabel: WKInterfaceLabel! 17 | @IBOutlet var incrementButton: WKInterfaceButton! 18 | 19 | let context = CoreDataStorage.mainQueueContext() 20 | var counter: Counter? 21 | 22 | override func awake(withContext context: Any?) { 23 | super.awake(withContext: context) 24 | 25 | fetchData() 26 | } 27 | 28 | override func willActivate() { 29 | // This method is called when watch view controller is about to be visible to user 30 | super.willActivate() 31 | } 32 | 33 | override func didDeactivate() { 34 | // This method is called when watch view controller is no longer visible 35 | super.didDeactivate() 36 | } 37 | 38 | // MARK: - Logic 39 | 40 | func fetchData() { 41 | self.context.performAndWait{ () -> Void in 42 | 43 | let counter = NSManagedObject.findAllForEntity("Counter", context: self.context) 44 | 45 | if (counter?.last != nil) { 46 | self.counter = (counter?.last as! Counter) 47 | } 48 | else { 49 | self.counter = (NSEntityDescription.insertNewObject(forEntityName: "Counter", into: self.context) as! Counter) 50 | self.counter?.title = "Counter" 51 | self.counter?.value = 0 52 | } 53 | 54 | self.updateUI() 55 | } 56 | } 57 | 58 | func updateUI() { 59 | titleLabel.setText(counter?.title) 60 | valueLabel.setText(counter?.value?.stringValue) 61 | } 62 | 63 | func save() { 64 | CoreDataStorage.saveContext(self.context) 65 | } 66 | 67 | // MARK: - Actions 68 | 69 | @IBAction func incrementButtonAction() { 70 | let value = counter?.value?.intValue 71 | counter?.value = (value! + 1) as NSNumber? 72 | 73 | updateUI() 74 | save() 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup WatchKit 1 Extension/TutorialAppGroup WatchKit 1 Extension.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.com.maximbilan.tutorialappgroup 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6D59B0791DB7BAFB000751DB /* TutorialAppGroup WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 947318E21BD3E5F2007189D7 /* TutorialAppGroup WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 11 | 6D59B07C1DB7BAFB000751DB /* TutorialAppGroup WatchKit App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 947318EB1BD3E5F2007189D7 /* TutorialAppGroup WatchKit App.app */; }; 12 | 947318B41BD3E4A5007189D7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 947318B31BD3E4A5007189D7 /* AppDelegate.swift */; }; 13 | 947318B61BD3E4A5007189D7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 947318B51BD3E4A5007189D7 /* ViewController.swift */; }; 14 | 947318B91BD3E4A5007189D7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 947318B71BD3E4A5007189D7 /* Main.storyboard */; }; 15 | 947318BC1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 947318BA1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodeld */; }; 16 | 947318BE1BD3E4A5007189D7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 947318BD1BD3E4A5007189D7 /* Assets.xcassets */; }; 17 | 947318C11BD3E4A5007189D7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 947318BF1BD3E4A5007189D7 /* LaunchScreen.storyboard */; }; 18 | 947318CF1BD3E583007189D7 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 947318CE1BD3E583007189D7 /* NotificationCenter.framework */; }; 19 | 947318D21BD3E583007189D7 /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 947318D11BD3E583007189D7 /* TodayViewController.swift */; }; 20 | 947318D51BD3E583007189D7 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 947318D31BD3E583007189D7 /* MainInterface.storyboard */; }; 21 | 947318D91BD3E583007189D7 /* TutorialAppGroup Today Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 947318CC1BD3E583007189D7 /* TutorialAppGroup Today Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 22 | 947318E51BD3E5F2007189D7 /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 947318E41BD3E5F2007189D7 /* InterfaceController.swift */; }; 23 | 947318E71BD3E5F2007189D7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 947318E61BD3E5F2007189D7 /* Assets.xcassets */; }; 24 | 947318F21BD3E5F2007189D7 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 947318F01BD3E5F2007189D7 /* Interface.storyboard */; }; 25 | 947318F41BD3E5F2007189D7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 947318F31BD3E5F2007189D7 /* Assets.xcassets */; }; 26 | 947319031BD3F295007189D7 /* TutorialAppGroup.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 947318BA1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodeld */; }; 27 | 947319041BD3F296007189D7 /* TutorialAppGroup.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 947318BA1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodeld */; }; 28 | 947319071BD3F2E4007189D7 /* CoreDataStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 947319061BD3F2E4007189D7 /* CoreDataStorage.swift */; }; 29 | 947319081BD3F2E4007189D7 /* CoreDataStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 947319061BD3F2E4007189D7 /* CoreDataStorage.swift */; }; 30 | 947319091BD3F2E4007189D7 /* CoreDataStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 947319061BD3F2E4007189D7 /* CoreDataStorage.swift */; }; 31 | 9473190C1BD3F513007189D7 /* Counter+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9473190A1BD3F513007189D7 /* Counter+CoreDataProperties.swift */; }; 32 | 9473190D1BD3F513007189D7 /* Counter+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9473190A1BD3F513007189D7 /* Counter+CoreDataProperties.swift */; }; 33 | 9473190E1BD3F513007189D7 /* Counter+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9473190A1BD3F513007189D7 /* Counter+CoreDataProperties.swift */; }; 34 | 9473190F1BD3F513007189D7 /* Counter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9473190B1BD3F513007189D7 /* Counter.swift */; }; 35 | 947319101BD3F513007189D7 /* Counter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9473190B1BD3F513007189D7 /* Counter.swift */; }; 36 | 947319111BD3F513007189D7 /* Counter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9473190B1BD3F513007189D7 /* Counter.swift */; }; 37 | /* End PBXBuildFile section */ 38 | 39 | /* Begin PBXContainerItemProxy section */ 40 | 6D59B0771DB7BAFB000751DB /* PBXContainerItemProxy */ = { 41 | isa = PBXContainerItemProxy; 42 | containerPortal = 947318A81BD3E4A5007189D7 /* Project object */; 43 | proxyType = 1; 44 | remoteGlobalIDString = 947318E11BD3E5F2007189D7; 45 | remoteInfo = "TutorialAppGroup WatchKit Extension"; 46 | }; 47 | 6D59B07A1DB7BAFB000751DB /* PBXContainerItemProxy */ = { 48 | isa = PBXContainerItemProxy; 49 | containerPortal = 947318A81BD3E4A5007189D7 /* Project object */; 50 | proxyType = 1; 51 | remoteGlobalIDString = 947318EA1BD3E5F2007189D7; 52 | remoteInfo = "TutorialAppGroup WatchKit App"; 53 | }; 54 | 947318D71BD3E583007189D7 /* PBXContainerItemProxy */ = { 55 | isa = PBXContainerItemProxy; 56 | containerPortal = 947318A81BD3E4A5007189D7 /* Project object */; 57 | proxyType = 1; 58 | remoteGlobalIDString = 947318CB1BD3E583007189D7; 59 | remoteInfo = "Tutorial App Group Today Extension"; 60 | }; 61 | /* End PBXContainerItemProxy section */ 62 | 63 | /* Begin PBXCopyFilesBuildPhase section */ 64 | 6D59B07D1DB7BAFB000751DB /* Embed App Extensions */ = { 65 | isa = PBXCopyFilesBuildPhase; 66 | buildActionMask = 2147483647; 67 | dstPath = ""; 68 | dstSubfolderSpec = 13; 69 | files = ( 70 | 6D59B0791DB7BAFB000751DB /* TutorialAppGroup WatchKit Extension.appex in Embed App Extensions */, 71 | ); 72 | name = "Embed App Extensions"; 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 6D59B07E1DB7BAFB000751DB /* Embed Watch Content */ = { 76 | isa = PBXCopyFilesBuildPhase; 77 | buildActionMask = 2147483647; 78 | dstPath = "$(CONTENTS_FOLDER_PATH)/Watch"; 79 | dstSubfolderSpec = 16; 80 | files = ( 81 | 6D59B07C1DB7BAFB000751DB /* TutorialAppGroup WatchKit App.app in Embed Watch Content */, 82 | ); 83 | name = "Embed Watch Content"; 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 947318DD1BD3E583007189D7 /* Embed App Extensions */ = { 87 | isa = PBXCopyFilesBuildPhase; 88 | buildActionMask = 2147483647; 89 | dstPath = ""; 90 | dstSubfolderSpec = 13; 91 | files = ( 92 | 947318D91BD3E583007189D7 /* TutorialAppGroup Today Extension.appex in Embed App Extensions */, 93 | ); 94 | name = "Embed App Extensions"; 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | /* End PBXCopyFilesBuildPhase section */ 98 | 99 | /* Begin PBXFileReference section */ 100 | 947318B01BD3E4A5007189D7 /* TutorialAppGroup.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TutorialAppGroup.app; sourceTree = BUILT_PRODUCTS_DIR; }; 101 | 947318B31BD3E4A5007189D7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 102 | 947318B51BD3E4A5007189D7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 103 | 947318B81BD3E4A5007189D7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 104 | 947318BB1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = TutorialAppGroup.xcdatamodel; sourceTree = ""; }; 105 | 947318BD1BD3E4A5007189D7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 106 | 947318C01BD3E4A5007189D7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 107 | 947318C21BD3E4A5007189D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 108 | 947318CC1BD3E583007189D7 /* TutorialAppGroup Today Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "TutorialAppGroup Today Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 109 | 947318CE1BD3E583007189D7 /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; 110 | 947318D11BD3E583007189D7 /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = ""; }; 111 | 947318D41BD3E583007189D7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; 112 | 947318D61BD3E583007189D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 113 | 947318E21BD3E5F2007189D7 /* TutorialAppGroup WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "TutorialAppGroup WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 114 | 947318E41BD3E5F2007189D7 /* InterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceController.swift; sourceTree = ""; }; 115 | 947318E61BD3E5F2007189D7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 116 | 947318E81BD3E5F2007189D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 117 | 947318EB1BD3E5F2007189D7 /* TutorialAppGroup WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TutorialAppGroup WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 118 | 947318F11BD3E5F2007189D7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = ""; }; 119 | 947318F31BD3E5F2007189D7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 120 | 947318F51BD3E5F2007189D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 121 | 947318FF1BD3E9E5007189D7 /* TutorialAppGroup.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = TutorialAppGroup.entitlements; sourceTree = ""; }; 122 | 947319001BD3EA08007189D7 /* TutorialAppGroup Today Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "TutorialAppGroup Today Extension.entitlements"; sourceTree = ""; }; 123 | 947319011BD3EA14007189D7 /* TutorialAppGroup WatchKit 1 Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "TutorialAppGroup WatchKit 1 Extension.entitlements"; sourceTree = ""; }; 124 | 947319021BD3EA22007189D7 /* TutorialAppGroup WatchKit 1 App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "TutorialAppGroup WatchKit 1 App.entitlements"; sourceTree = ""; }; 125 | 947319061BD3F2E4007189D7 /* CoreDataStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataStorage.swift; sourceTree = ""; }; 126 | 9473190A1BD3F513007189D7 /* Counter+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Counter+CoreDataProperties.swift"; sourceTree = ""; }; 127 | 9473190B1BD3F513007189D7 /* Counter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Counter.swift; sourceTree = ""; }; 128 | /* End PBXFileReference section */ 129 | 130 | /* Begin PBXFrameworksBuildPhase section */ 131 | 947318AD1BD3E4A5007189D7 /* Frameworks */ = { 132 | isa = PBXFrameworksBuildPhase; 133 | buildActionMask = 2147483647; 134 | files = ( 135 | ); 136 | runOnlyForDeploymentPostprocessing = 0; 137 | }; 138 | 947318C91BD3E583007189D7 /* Frameworks */ = { 139 | isa = PBXFrameworksBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | 947318CF1BD3E583007189D7 /* NotificationCenter.framework in Frameworks */, 143 | ); 144 | runOnlyForDeploymentPostprocessing = 0; 145 | }; 146 | 947318DF1BD3E5F2007189D7 /* Frameworks */ = { 147 | isa = PBXFrameworksBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | ); 151 | runOnlyForDeploymentPostprocessing = 0; 152 | }; 153 | /* End PBXFrameworksBuildPhase section */ 154 | 155 | /* Begin PBXGroup section */ 156 | 947318A71BD3E4A5007189D7 = { 157 | isa = PBXGroup; 158 | children = ( 159 | 947319051BD3F2CE007189D7 /* Shared */, 160 | 947318B21BD3E4A5007189D7 /* TutorialAppGroup */, 161 | 947318D01BD3E583007189D7 /* TutorialAppGroup Today Extension */, 162 | 947318E31BD3E5F2007189D7 /* TutorialAppGroup WatchKit 1 Extension */, 163 | 947318EF1BD3E5F2007189D7 /* TutorialAppGroup WatchKit 1 App */, 164 | 947318CD1BD3E583007189D7 /* Frameworks */, 165 | 947318B11BD3E4A5007189D7 /* Products */, 166 | ); 167 | sourceTree = ""; 168 | }; 169 | 947318B11BD3E4A5007189D7 /* Products */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | 947318B01BD3E4A5007189D7 /* TutorialAppGroup.app */, 173 | 947318CC1BD3E583007189D7 /* TutorialAppGroup Today Extension.appex */, 174 | 947318E21BD3E5F2007189D7 /* TutorialAppGroup WatchKit Extension.appex */, 175 | 947318EB1BD3E5F2007189D7 /* TutorialAppGroup WatchKit App.app */, 176 | ); 177 | name = Products; 178 | sourceTree = ""; 179 | }; 180 | 947318B21BD3E4A5007189D7 /* TutorialAppGroup */ = { 181 | isa = PBXGroup; 182 | children = ( 183 | 947318FF1BD3E9E5007189D7 /* TutorialAppGroup.entitlements */, 184 | 947318B31BD3E4A5007189D7 /* AppDelegate.swift */, 185 | 947318B51BD3E4A5007189D7 /* ViewController.swift */, 186 | 947318B71BD3E4A5007189D7 /* Main.storyboard */, 187 | 947318BD1BD3E4A5007189D7 /* Assets.xcassets */, 188 | 947318BF1BD3E4A5007189D7 /* LaunchScreen.storyboard */, 189 | 947318C21BD3E4A5007189D7 /* Info.plist */, 190 | 947318BA1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodeld */, 191 | ); 192 | path = TutorialAppGroup; 193 | sourceTree = ""; 194 | }; 195 | 947318CD1BD3E583007189D7 /* Frameworks */ = { 196 | isa = PBXGroup; 197 | children = ( 198 | 947318CE1BD3E583007189D7 /* NotificationCenter.framework */, 199 | ); 200 | name = Frameworks; 201 | sourceTree = ""; 202 | }; 203 | 947318D01BD3E583007189D7 /* TutorialAppGroup Today Extension */ = { 204 | isa = PBXGroup; 205 | children = ( 206 | 947319001BD3EA08007189D7 /* TutorialAppGroup Today Extension.entitlements */, 207 | 947318D11BD3E583007189D7 /* TodayViewController.swift */, 208 | 947318D31BD3E583007189D7 /* MainInterface.storyboard */, 209 | 947318D61BD3E583007189D7 /* Info.plist */, 210 | ); 211 | path = "TutorialAppGroup Today Extension"; 212 | sourceTree = ""; 213 | }; 214 | 947318E31BD3E5F2007189D7 /* TutorialAppGroup WatchKit 1 Extension */ = { 215 | isa = PBXGroup; 216 | children = ( 217 | 947319011BD3EA14007189D7 /* TutorialAppGroup WatchKit 1 Extension.entitlements */, 218 | 947318E41BD3E5F2007189D7 /* InterfaceController.swift */, 219 | 947318E61BD3E5F2007189D7 /* Assets.xcassets */, 220 | 947318E81BD3E5F2007189D7 /* Info.plist */, 221 | ); 222 | path = "TutorialAppGroup WatchKit 1 Extension"; 223 | sourceTree = ""; 224 | }; 225 | 947318EF1BD3E5F2007189D7 /* TutorialAppGroup WatchKit 1 App */ = { 226 | isa = PBXGroup; 227 | children = ( 228 | 947319021BD3EA22007189D7 /* TutorialAppGroup WatchKit 1 App.entitlements */, 229 | 947318F01BD3E5F2007189D7 /* Interface.storyboard */, 230 | 947318F31BD3E5F2007189D7 /* Assets.xcassets */, 231 | 947318F51BD3E5F2007189D7 /* Info.plist */, 232 | ); 233 | path = "TutorialAppGroup WatchKit 1 App"; 234 | sourceTree = ""; 235 | }; 236 | 947319051BD3F2CE007189D7 /* Shared */ = { 237 | isa = PBXGroup; 238 | children = ( 239 | 947319061BD3F2E4007189D7 /* CoreDataStorage.swift */, 240 | 9473190A1BD3F513007189D7 /* Counter+CoreDataProperties.swift */, 241 | 9473190B1BD3F513007189D7 /* Counter.swift */, 242 | ); 243 | path = Shared; 244 | sourceTree = ""; 245 | }; 246 | /* End PBXGroup section */ 247 | 248 | /* Begin PBXNativeTarget section */ 249 | 947318AF1BD3E4A5007189D7 /* TutorialAppGroup */ = { 250 | isa = PBXNativeTarget; 251 | buildConfigurationList = 947318C51BD3E4A5007189D7 /* Build configuration list for PBXNativeTarget "TutorialAppGroup" */; 252 | buildPhases = ( 253 | 947318AC1BD3E4A5007189D7 /* Sources */, 254 | 947318AD1BD3E4A5007189D7 /* Frameworks */, 255 | 947318AE1BD3E4A5007189D7 /* Resources */, 256 | 947318DD1BD3E583007189D7 /* Embed App Extensions */, 257 | 6D59B07E1DB7BAFB000751DB /* Embed Watch Content */, 258 | ); 259 | buildRules = ( 260 | ); 261 | dependencies = ( 262 | 947318D81BD3E583007189D7 /* PBXTargetDependency */, 263 | 6D59B07B1DB7BAFB000751DB /* PBXTargetDependency */, 264 | ); 265 | name = TutorialAppGroup; 266 | productName = TutorialAppGroup; 267 | productReference = 947318B01BD3E4A5007189D7 /* TutorialAppGroup.app */; 268 | productType = "com.apple.product-type.application"; 269 | }; 270 | 947318CB1BD3E583007189D7 /* TutorialAppGroup Today Extension */ = { 271 | isa = PBXNativeTarget; 272 | buildConfigurationList = 947318DA1BD3E583007189D7 /* Build configuration list for PBXNativeTarget "TutorialAppGroup Today Extension" */; 273 | buildPhases = ( 274 | 947318C81BD3E583007189D7 /* Sources */, 275 | 947318C91BD3E583007189D7 /* Frameworks */, 276 | 947318CA1BD3E583007189D7 /* Resources */, 277 | ); 278 | buildRules = ( 279 | ); 280 | dependencies = ( 281 | ); 282 | name = "TutorialAppGroup Today Extension"; 283 | productName = "Tutorial App Group Today Extension"; 284 | productReference = 947318CC1BD3E583007189D7 /* TutorialAppGroup Today Extension.appex */; 285 | productType = "com.apple.product-type.app-extension"; 286 | }; 287 | 947318E11BD3E5F2007189D7 /* TutorialAppGroup WatchKit Extension */ = { 288 | isa = PBXNativeTarget; 289 | buildConfigurationList = 947318FC1BD3E5F2007189D7 /* Build configuration list for PBXNativeTarget "TutorialAppGroup WatchKit Extension" */; 290 | buildPhases = ( 291 | 947318DE1BD3E5F2007189D7 /* Sources */, 292 | 947318DF1BD3E5F2007189D7 /* Frameworks */, 293 | 947318E01BD3E5F2007189D7 /* Resources */, 294 | ); 295 | buildRules = ( 296 | ); 297 | dependencies = ( 298 | ); 299 | name = "TutorialAppGroup WatchKit Extension"; 300 | productName = "TutorialAppGroup WatchKit 1 Extension"; 301 | productReference = 947318E21BD3E5F2007189D7 /* TutorialAppGroup WatchKit Extension.appex */; 302 | productType = "com.apple.product-type.watchkit2-extension"; 303 | }; 304 | 947318EA1BD3E5F2007189D7 /* TutorialAppGroup WatchKit App */ = { 305 | isa = PBXNativeTarget; 306 | buildConfigurationList = 947318F91BD3E5F2007189D7 /* Build configuration list for PBXNativeTarget "TutorialAppGroup WatchKit App" */; 307 | buildPhases = ( 308 | 947318E91BD3E5F2007189D7 /* Resources */, 309 | 6D59B07D1DB7BAFB000751DB /* Embed App Extensions */, 310 | ); 311 | buildRules = ( 312 | ); 313 | dependencies = ( 314 | 6D59B0781DB7BAFB000751DB /* PBXTargetDependency */, 315 | ); 316 | name = "TutorialAppGroup WatchKit App"; 317 | productName = "TutorialAppGroup WatchKit 1 App"; 318 | productReference = 947318EB1BD3E5F2007189D7 /* TutorialAppGroup WatchKit App.app */; 319 | productType = "com.apple.product-type.application.watchapp2"; 320 | }; 321 | /* End PBXNativeTarget section */ 322 | 323 | /* Begin PBXProject section */ 324 | 947318A81BD3E4A5007189D7 /* Project object */ = { 325 | isa = PBXProject; 326 | attributes = { 327 | LastUpgradeCheck = 1000; 328 | ORGANIZATIONNAME = Maxim; 329 | TargetAttributes = { 330 | 947318AF1BD3E4A5007189D7 = { 331 | CreatedOnToolsVersion = 7.0.1; 332 | DevelopmentTeam = 828XSMPA74; 333 | LastSwiftMigration = 1000; 334 | ProvisioningStyle = Automatic; 335 | SystemCapabilities = { 336 | com.apple.ApplicationGroups.iOS = { 337 | enabled = 1; 338 | }; 339 | }; 340 | }; 341 | 947318CB1BD3E583007189D7 = { 342 | CreatedOnToolsVersion = 7.0.1; 343 | DevelopmentTeam = 828XSMPA74; 344 | LastSwiftMigration = 1000; 345 | ProvisioningStyle = Automatic; 346 | SystemCapabilities = { 347 | com.apple.ApplicationGroups.iOS = { 348 | enabled = 1; 349 | }; 350 | }; 351 | }; 352 | 947318E11BD3E5F2007189D7 = { 353 | CreatedOnToolsVersion = 7.0.1; 354 | DevelopmentTeam = 828XSMPA74; 355 | LastSwiftMigration = 1000; 356 | ProvisioningStyle = Automatic; 357 | SystemCapabilities = { 358 | com.apple.ApplicationGroups.iOS = { 359 | enabled = 1; 360 | }; 361 | }; 362 | }; 363 | 947318EA1BD3E5F2007189D7 = { 364 | CreatedOnToolsVersion = 7.0.1; 365 | DevelopmentTeam = 828XSMPA74; 366 | ProvisioningStyle = Automatic; 367 | SystemCapabilities = { 368 | com.apple.ApplicationGroups.iOS = { 369 | enabled = 1; 370 | }; 371 | }; 372 | }; 373 | }; 374 | }; 375 | buildConfigurationList = 947318AB1BD3E4A5007189D7 /* Build configuration list for PBXProject "TutorialAppGroup" */; 376 | compatibilityVersion = "Xcode 3.2"; 377 | developmentRegion = English; 378 | hasScannedForEncodings = 0; 379 | knownRegions = ( 380 | en, 381 | Base, 382 | ); 383 | mainGroup = 947318A71BD3E4A5007189D7; 384 | productRefGroup = 947318B11BD3E4A5007189D7 /* Products */; 385 | projectDirPath = ""; 386 | projectRoot = ""; 387 | targets = ( 388 | 947318AF1BD3E4A5007189D7 /* TutorialAppGroup */, 389 | 947318CB1BD3E583007189D7 /* TutorialAppGroup Today Extension */, 390 | 947318E11BD3E5F2007189D7 /* TutorialAppGroup WatchKit Extension */, 391 | 947318EA1BD3E5F2007189D7 /* TutorialAppGroup WatchKit App */, 392 | ); 393 | }; 394 | /* End PBXProject section */ 395 | 396 | /* Begin PBXResourcesBuildPhase section */ 397 | 947318AE1BD3E4A5007189D7 /* Resources */ = { 398 | isa = PBXResourcesBuildPhase; 399 | buildActionMask = 2147483647; 400 | files = ( 401 | 947318C11BD3E4A5007189D7 /* LaunchScreen.storyboard in Resources */, 402 | 947318BE1BD3E4A5007189D7 /* Assets.xcassets in Resources */, 403 | 947318B91BD3E4A5007189D7 /* Main.storyboard in Resources */, 404 | ); 405 | runOnlyForDeploymentPostprocessing = 0; 406 | }; 407 | 947318CA1BD3E583007189D7 /* Resources */ = { 408 | isa = PBXResourcesBuildPhase; 409 | buildActionMask = 2147483647; 410 | files = ( 411 | 947318D51BD3E583007189D7 /* MainInterface.storyboard in Resources */, 412 | ); 413 | runOnlyForDeploymentPostprocessing = 0; 414 | }; 415 | 947318E01BD3E5F2007189D7 /* Resources */ = { 416 | isa = PBXResourcesBuildPhase; 417 | buildActionMask = 2147483647; 418 | files = ( 419 | 947318E71BD3E5F2007189D7 /* Assets.xcassets in Resources */, 420 | ); 421 | runOnlyForDeploymentPostprocessing = 0; 422 | }; 423 | 947318E91BD3E5F2007189D7 /* Resources */ = { 424 | isa = PBXResourcesBuildPhase; 425 | buildActionMask = 2147483647; 426 | files = ( 427 | 947318F41BD3E5F2007189D7 /* Assets.xcassets in Resources */, 428 | 947318F21BD3E5F2007189D7 /* Interface.storyboard in Resources */, 429 | ); 430 | runOnlyForDeploymentPostprocessing = 0; 431 | }; 432 | /* End PBXResourcesBuildPhase section */ 433 | 434 | /* Begin PBXSourcesBuildPhase section */ 435 | 947318AC1BD3E4A5007189D7 /* Sources */ = { 436 | isa = PBXSourcesBuildPhase; 437 | buildActionMask = 2147483647; 438 | files = ( 439 | 947319071BD3F2E4007189D7 /* CoreDataStorage.swift in Sources */, 440 | 9473190C1BD3F513007189D7 /* Counter+CoreDataProperties.swift in Sources */, 441 | 9473190F1BD3F513007189D7 /* Counter.swift in Sources */, 442 | 947318B61BD3E4A5007189D7 /* ViewController.swift in Sources */, 443 | 947318BC1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodeld in Sources */, 444 | 947318B41BD3E4A5007189D7 /* AppDelegate.swift in Sources */, 445 | ); 446 | runOnlyForDeploymentPostprocessing = 0; 447 | }; 448 | 947318C81BD3E583007189D7 /* Sources */ = { 449 | isa = PBXSourcesBuildPhase; 450 | buildActionMask = 2147483647; 451 | files = ( 452 | 947319101BD3F513007189D7 /* Counter.swift in Sources */, 453 | 9473190D1BD3F513007189D7 /* Counter+CoreDataProperties.swift in Sources */, 454 | 947319081BD3F2E4007189D7 /* CoreDataStorage.swift in Sources */, 455 | 947318D21BD3E583007189D7 /* TodayViewController.swift in Sources */, 456 | 947319031BD3F295007189D7 /* TutorialAppGroup.xcdatamodeld in Sources */, 457 | ); 458 | runOnlyForDeploymentPostprocessing = 0; 459 | }; 460 | 947318DE1BD3E5F2007189D7 /* Sources */ = { 461 | isa = PBXSourcesBuildPhase; 462 | buildActionMask = 2147483647; 463 | files = ( 464 | 947319111BD3F513007189D7 /* Counter.swift in Sources */, 465 | 9473190E1BD3F513007189D7 /* Counter+CoreDataProperties.swift in Sources */, 466 | 947319091BD3F2E4007189D7 /* CoreDataStorage.swift in Sources */, 467 | 947318E51BD3E5F2007189D7 /* InterfaceController.swift in Sources */, 468 | 947319041BD3F296007189D7 /* TutorialAppGroup.xcdatamodeld in Sources */, 469 | ); 470 | runOnlyForDeploymentPostprocessing = 0; 471 | }; 472 | /* End PBXSourcesBuildPhase section */ 473 | 474 | /* Begin PBXTargetDependency section */ 475 | 6D59B0781DB7BAFB000751DB /* PBXTargetDependency */ = { 476 | isa = PBXTargetDependency; 477 | target = 947318E11BD3E5F2007189D7 /* TutorialAppGroup WatchKit Extension */; 478 | targetProxy = 6D59B0771DB7BAFB000751DB /* PBXContainerItemProxy */; 479 | }; 480 | 6D59B07B1DB7BAFB000751DB /* PBXTargetDependency */ = { 481 | isa = PBXTargetDependency; 482 | target = 947318EA1BD3E5F2007189D7 /* TutorialAppGroup WatchKit App */; 483 | targetProxy = 6D59B07A1DB7BAFB000751DB /* PBXContainerItemProxy */; 484 | }; 485 | 947318D81BD3E583007189D7 /* PBXTargetDependency */ = { 486 | isa = PBXTargetDependency; 487 | target = 947318CB1BD3E583007189D7 /* TutorialAppGroup Today Extension */; 488 | targetProxy = 947318D71BD3E583007189D7 /* PBXContainerItemProxy */; 489 | }; 490 | /* End PBXTargetDependency section */ 491 | 492 | /* Begin PBXVariantGroup section */ 493 | 947318B71BD3E4A5007189D7 /* Main.storyboard */ = { 494 | isa = PBXVariantGroup; 495 | children = ( 496 | 947318B81BD3E4A5007189D7 /* Base */, 497 | ); 498 | name = Main.storyboard; 499 | sourceTree = ""; 500 | }; 501 | 947318BF1BD3E4A5007189D7 /* LaunchScreen.storyboard */ = { 502 | isa = PBXVariantGroup; 503 | children = ( 504 | 947318C01BD3E4A5007189D7 /* Base */, 505 | ); 506 | name = LaunchScreen.storyboard; 507 | sourceTree = ""; 508 | }; 509 | 947318D31BD3E583007189D7 /* MainInterface.storyboard */ = { 510 | isa = PBXVariantGroup; 511 | children = ( 512 | 947318D41BD3E583007189D7 /* Base */, 513 | ); 514 | name = MainInterface.storyboard; 515 | sourceTree = ""; 516 | }; 517 | 947318F01BD3E5F2007189D7 /* Interface.storyboard */ = { 518 | isa = PBXVariantGroup; 519 | children = ( 520 | 947318F11BD3E5F2007189D7 /* Base */, 521 | ); 522 | name = Interface.storyboard; 523 | sourceTree = ""; 524 | }; 525 | /* End PBXVariantGroup section */ 526 | 527 | /* Begin XCBuildConfiguration section */ 528 | 947318C31BD3E4A5007189D7 /* Debug */ = { 529 | isa = XCBuildConfiguration; 530 | buildSettings = { 531 | ALWAYS_SEARCH_USER_PATHS = NO; 532 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 533 | CLANG_CXX_LIBRARY = "libc++"; 534 | CLANG_ENABLE_MODULES = YES; 535 | CLANG_ENABLE_OBJC_ARC = YES; 536 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 537 | CLANG_WARN_BOOL_CONVERSION = YES; 538 | CLANG_WARN_COMMA = YES; 539 | CLANG_WARN_CONSTANT_CONVERSION = YES; 540 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 541 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 542 | CLANG_WARN_EMPTY_BODY = YES; 543 | CLANG_WARN_ENUM_CONVERSION = YES; 544 | CLANG_WARN_INFINITE_RECURSION = YES; 545 | CLANG_WARN_INT_CONVERSION = YES; 546 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 547 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 548 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 549 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 550 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 551 | CLANG_WARN_STRICT_PROTOTYPES = YES; 552 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 553 | CLANG_WARN_UNREACHABLE_CODE = YES; 554 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 555 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 556 | COPY_PHASE_STRIP = NO; 557 | DEBUG_INFORMATION_FORMAT = dwarf; 558 | ENABLE_STRICT_OBJC_MSGSEND = YES; 559 | ENABLE_TESTABILITY = YES; 560 | GCC_C_LANGUAGE_STANDARD = gnu99; 561 | GCC_DYNAMIC_NO_PIC = NO; 562 | GCC_NO_COMMON_BLOCKS = YES; 563 | GCC_OPTIMIZATION_LEVEL = 0; 564 | GCC_PREPROCESSOR_DEFINITIONS = ( 565 | "DEBUG=1", 566 | "$(inherited)", 567 | ); 568 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 569 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 570 | GCC_WARN_UNDECLARED_SELECTOR = YES; 571 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 572 | GCC_WARN_UNUSED_FUNCTION = YES; 573 | GCC_WARN_UNUSED_VARIABLE = YES; 574 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 575 | MTL_ENABLE_DEBUG_INFO = YES; 576 | ONLY_ACTIVE_ARCH = YES; 577 | SDKROOT = iphoneos; 578 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 579 | TARGETED_DEVICE_FAMILY = "1,2"; 580 | }; 581 | name = Debug; 582 | }; 583 | 947318C41BD3E4A5007189D7 /* Release */ = { 584 | isa = XCBuildConfiguration; 585 | buildSettings = { 586 | ALWAYS_SEARCH_USER_PATHS = NO; 587 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 588 | CLANG_CXX_LIBRARY = "libc++"; 589 | CLANG_ENABLE_MODULES = YES; 590 | CLANG_ENABLE_OBJC_ARC = YES; 591 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 592 | CLANG_WARN_BOOL_CONVERSION = YES; 593 | CLANG_WARN_COMMA = YES; 594 | CLANG_WARN_CONSTANT_CONVERSION = YES; 595 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 596 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 597 | CLANG_WARN_EMPTY_BODY = YES; 598 | CLANG_WARN_ENUM_CONVERSION = YES; 599 | CLANG_WARN_INFINITE_RECURSION = YES; 600 | CLANG_WARN_INT_CONVERSION = YES; 601 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 602 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 603 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 604 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 605 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 606 | CLANG_WARN_STRICT_PROTOTYPES = YES; 607 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 608 | CLANG_WARN_UNREACHABLE_CODE = YES; 609 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 610 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 611 | COPY_PHASE_STRIP = NO; 612 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 613 | ENABLE_NS_ASSERTIONS = NO; 614 | ENABLE_STRICT_OBJC_MSGSEND = YES; 615 | GCC_C_LANGUAGE_STANDARD = gnu99; 616 | GCC_NO_COMMON_BLOCKS = YES; 617 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 618 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 619 | GCC_WARN_UNDECLARED_SELECTOR = YES; 620 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 621 | GCC_WARN_UNUSED_FUNCTION = YES; 622 | GCC_WARN_UNUSED_VARIABLE = YES; 623 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 624 | MTL_ENABLE_DEBUG_INFO = NO; 625 | SDKROOT = iphoneos; 626 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 627 | TARGETED_DEVICE_FAMILY = "1,2"; 628 | VALIDATE_PRODUCT = YES; 629 | }; 630 | name = Release; 631 | }; 632 | 947318C61BD3E4A5007189D7 /* Debug */ = { 633 | isa = XCBuildConfiguration; 634 | buildSettings = { 635 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 636 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 637 | CODE_SIGN_ENTITLEMENTS = TutorialAppGroup/TutorialAppGroup.entitlements; 638 | CODE_SIGN_IDENTITY = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 639 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 640 | DEVELOPMENT_TEAM = 828XSMPA74; 641 | INFOPLIST_FILE = TutorialAppGroup/Info.plist; 642 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 643 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.tutorialappgroup; 644 | PRODUCT_NAME = "$(TARGET_NAME)"; 645 | PROVISIONING_PROFILE = ""; 646 | PROVISIONING_PROFILE_SPECIFIER = ""; 647 | SWIFT_VERSION = 4.2; 648 | }; 649 | name = Debug; 650 | }; 651 | 947318C71BD3E4A5007189D7 /* Release */ = { 652 | isa = XCBuildConfiguration; 653 | buildSettings = { 654 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 655 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 656 | CODE_SIGN_ENTITLEMENTS = TutorialAppGroup/TutorialAppGroup.entitlements; 657 | CODE_SIGN_IDENTITY = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 658 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 659 | DEVELOPMENT_TEAM = 828XSMPA74; 660 | INFOPLIST_FILE = TutorialAppGroup/Info.plist; 661 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 662 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.tutorialappgroup; 663 | PRODUCT_NAME = "$(TARGET_NAME)"; 664 | PROVISIONING_PROFILE = ""; 665 | PROVISIONING_PROFILE_SPECIFIER = ""; 666 | SWIFT_VERSION = 4.2; 667 | }; 668 | name = Release; 669 | }; 670 | 947318DB1BD3E583007189D7 /* Debug */ = { 671 | isa = XCBuildConfiguration; 672 | buildSettings = { 673 | CODE_SIGN_ENTITLEMENTS = "TutorialAppGroup Today Extension/TutorialAppGroup Today Extension.entitlements"; 674 | CODE_SIGN_IDENTITY = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 675 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 676 | INFOPLIST_FILE = "$(SRCROOT)/TutorialAppGroup Today Extension/Info.plist"; 677 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 678 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.tutorialappgroup.todayextension; 679 | PRODUCT_NAME = "$(TARGET_NAME)"; 680 | PROVISIONING_PROFILE = ""; 681 | SKIP_INSTALL = YES; 682 | SWIFT_VERSION = 4.2; 683 | }; 684 | name = Debug; 685 | }; 686 | 947318DC1BD3E583007189D7 /* Release */ = { 687 | isa = XCBuildConfiguration; 688 | buildSettings = { 689 | CODE_SIGN_ENTITLEMENTS = "TutorialAppGroup Today Extension/TutorialAppGroup Today Extension.entitlements"; 690 | CODE_SIGN_IDENTITY = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 691 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 692 | INFOPLIST_FILE = "$(SRCROOT)/TutorialAppGroup Today Extension/Info.plist"; 693 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 694 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.tutorialappgroup.todayextension; 695 | PRODUCT_NAME = "$(TARGET_NAME)"; 696 | PROVISIONING_PROFILE = ""; 697 | SKIP_INSTALL = YES; 698 | SWIFT_VERSION = 4.2; 699 | }; 700 | name = Release; 701 | }; 702 | 947318FA1BD3E5F2007189D7 /* Debug */ = { 703 | isa = XCBuildConfiguration; 704 | buildSettings = { 705 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 706 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 707 | CODE_SIGN_ENTITLEMENTS = "TutorialAppGroup WatchKit 1 App/TutorialAppGroup WatchKit 1 App.entitlements"; 708 | CODE_SIGN_IDENTITY = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 709 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 710 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; 711 | DEVELOPMENT_TEAM = ""; 712 | IBSC_MODULE = TutorialAppGroup_WatchKit_1_Extension; 713 | INFOPLIST_FILE = "TutorialAppGroup WatchKit 1 App/Info.plist"; 714 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.tutorialappgroup.watchkitapp; 715 | PRODUCT_NAME = "$(TARGET_NAME)"; 716 | PROVISIONING_PROFILE = ""; 717 | PROVISIONING_PROFILE_SPECIFIER = ""; 718 | SDKROOT = watchos; 719 | SKIP_INSTALL = YES; 720 | TARGETED_DEVICE_FAMILY = 4; 721 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 722 | }; 723 | name = Debug; 724 | }; 725 | 947318FB1BD3E5F2007189D7 /* Release */ = { 726 | isa = XCBuildConfiguration; 727 | buildSettings = { 728 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 729 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 730 | CODE_SIGN_ENTITLEMENTS = "TutorialAppGroup WatchKit 1 App/TutorialAppGroup WatchKit 1 App.entitlements"; 731 | CODE_SIGN_IDENTITY = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 732 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 733 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; 734 | IBSC_MODULE = TutorialAppGroup_WatchKit_1_Extension; 735 | INFOPLIST_FILE = "TutorialAppGroup WatchKit 1 App/Info.plist"; 736 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.tutorialappgroup.watchkitapp; 737 | PRODUCT_NAME = "$(TARGET_NAME)"; 738 | PROVISIONING_PROFILE = ""; 739 | SDKROOT = watchos; 740 | SKIP_INSTALL = YES; 741 | TARGETED_DEVICE_FAMILY = 4; 742 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 743 | }; 744 | name = Release; 745 | }; 746 | 947318FD1BD3E5F2007189D7 /* Debug */ = { 747 | isa = XCBuildConfiguration; 748 | buildSettings = { 749 | CODE_SIGN_ENTITLEMENTS = "TutorialAppGroup WatchKit 1 Extension/TutorialAppGroup WatchKit 1 Extension.entitlements"; 750 | CODE_SIGN_IDENTITY = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 751 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 752 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; 753 | INFOPLIST_FILE = "TutorialAppGroup WatchKit 1 Extension/Info.plist"; 754 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 755 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.tutorialappgroup.watchkitapp.watchkitextension; 756 | PRODUCT_NAME = "${TARGET_NAME}"; 757 | PROVISIONING_PROFILE = ""; 758 | SDKROOT = watchos; 759 | SKIP_INSTALL = YES; 760 | SWIFT_VERSION = 4.2; 761 | TARGETED_DEVICE_FAMILY = 4; 762 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 763 | }; 764 | name = Debug; 765 | }; 766 | 947318FE1BD3E5F2007189D7 /* Release */ = { 767 | isa = XCBuildConfiguration; 768 | buildSettings = { 769 | CODE_SIGN_ENTITLEMENTS = "TutorialAppGroup WatchKit 1 Extension/TutorialAppGroup WatchKit 1 Extension.entitlements"; 770 | CODE_SIGN_IDENTITY = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 771 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Maxim Bilan (HXGL6HW737)"; 772 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; 773 | INFOPLIST_FILE = "TutorialAppGroup WatchKit 1 Extension/Info.plist"; 774 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 775 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.tutorialappgroup.watchkitapp.watchkitextension; 776 | PRODUCT_NAME = "${TARGET_NAME}"; 777 | PROVISIONING_PROFILE = ""; 778 | SDKROOT = watchos; 779 | SKIP_INSTALL = YES; 780 | SWIFT_VERSION = 4.2; 781 | TARGETED_DEVICE_FAMILY = 4; 782 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 783 | }; 784 | name = Release; 785 | }; 786 | /* End XCBuildConfiguration section */ 787 | 788 | /* Begin XCConfigurationList section */ 789 | 947318AB1BD3E4A5007189D7 /* Build configuration list for PBXProject "TutorialAppGroup" */ = { 790 | isa = XCConfigurationList; 791 | buildConfigurations = ( 792 | 947318C31BD3E4A5007189D7 /* Debug */, 793 | 947318C41BD3E4A5007189D7 /* Release */, 794 | ); 795 | defaultConfigurationIsVisible = 0; 796 | defaultConfigurationName = Release; 797 | }; 798 | 947318C51BD3E4A5007189D7 /* Build configuration list for PBXNativeTarget "TutorialAppGroup" */ = { 799 | isa = XCConfigurationList; 800 | buildConfigurations = ( 801 | 947318C61BD3E4A5007189D7 /* Debug */, 802 | 947318C71BD3E4A5007189D7 /* Release */, 803 | ); 804 | defaultConfigurationIsVisible = 0; 805 | defaultConfigurationName = Release; 806 | }; 807 | 947318DA1BD3E583007189D7 /* Build configuration list for PBXNativeTarget "TutorialAppGroup Today Extension" */ = { 808 | isa = XCConfigurationList; 809 | buildConfigurations = ( 810 | 947318DB1BD3E583007189D7 /* Debug */, 811 | 947318DC1BD3E583007189D7 /* Release */, 812 | ); 813 | defaultConfigurationIsVisible = 0; 814 | defaultConfigurationName = Release; 815 | }; 816 | 947318F91BD3E5F2007189D7 /* Build configuration list for PBXNativeTarget "TutorialAppGroup WatchKit App" */ = { 817 | isa = XCConfigurationList; 818 | buildConfigurations = ( 819 | 947318FA1BD3E5F2007189D7 /* Debug */, 820 | 947318FB1BD3E5F2007189D7 /* Release */, 821 | ); 822 | defaultConfigurationIsVisible = 0; 823 | defaultConfigurationName = Release; 824 | }; 825 | 947318FC1BD3E5F2007189D7 /* Build configuration list for PBXNativeTarget "TutorialAppGroup WatchKit Extension" */ = { 826 | isa = XCConfigurationList; 827 | buildConfigurations = ( 828 | 947318FD1BD3E5F2007189D7 /* Debug */, 829 | 947318FE1BD3E5F2007189D7 /* Release */, 830 | ); 831 | defaultConfigurationIsVisible = 0; 832 | defaultConfigurationName = Release; 833 | }; 834 | /* End XCConfigurationList section */ 835 | 836 | /* Begin XCVersionGroup section */ 837 | 947318BA1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodeld */ = { 838 | isa = XCVersionGroup; 839 | children = ( 840 | 947318BB1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodel */, 841 | ); 842 | currentVersion = 947318BB1BD3E4A5007189D7 /* TutorialAppGroup.xcdatamodel */; 843 | path = TutorialAppGroup.xcdatamodeld; 844 | sourceTree = ""; 845 | versionGroupType = wrapper.xcdatamodel; 846 | }; 847 | /* End XCVersionGroup section */ 848 | }; 849 | rootObject = 947318A81BD3E4A5007189D7 /* Project object */; 850 | } 851 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // TutorialAppGroup 4 | // 5 | // Created by Maxim on 10/18/15. 6 | // Copyright © 2015 Maxim. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { 19 | // Override point for customization after application launch. 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(_ application: UIApplication) { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | func applicationDidEnterBackground(_ application: UIApplication) { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | func applicationWillEnterForeground(_ application: UIApplication) { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | func applicationDidBecomeActive(_ application: UIApplication) { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | func applicationWillTerminate(_ application: UIApplication) { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | // Saves changes in the application's managed object context before the application terminates. 44 | let context = CoreDataStorage.mainQueueContext() 45 | CoreDataStorage.saveContext(context) 46 | } 47 | 48 | } 49 | 50 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 30 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup/TutorialAppGroup.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.com.maximbilan.tutorialappgroup 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup/TutorialAppGroup.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | TutorialAppGroup.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup/TutorialAppGroup.xcdatamodeld/TutorialAppGroup.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /TutorialAppGroup/TutorialAppGroup/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // TutorialAppGroup 4 | // 5 | // Created by Maxim on 10/18/15. 6 | // Copyright © 2015 Maxim. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet weak var titleLabel: UILabel! 15 | @IBOutlet weak var valueLabel: UILabel! 16 | @IBOutlet weak var incrementButton: UIButton! 17 | 18 | var counter: Counter? 19 | let context = CoreDataStorage.mainQueueContext() 20 | 21 | deinit { 22 | NotificationCenter.default.removeObserver(self) 23 | } 24 | 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | 28 | self.context.performAndWait{ () -> Void in 29 | 30 | let counter = NSManagedObject.findAllForEntity("Counter", context: self.context) 31 | 32 | if (counter?.last != nil) { 33 | self.counter = (counter?.last as! Counter) 34 | } 35 | else { 36 | self.counter = (NSEntityDescription.insertNewObject(forEntityName: "Counter", into: self.context) as! Counter) 37 | self.counter?.title = "Counter" 38 | self.counter?.value = 0 39 | } 40 | 41 | self.updateUI() 42 | } 43 | } 44 | 45 | // MARK: - Logic 46 | 47 | func updateUI() { 48 | titleLabel.text = counter?.title 49 | valueLabel.text = counter?.value?.stringValue 50 | } 51 | 52 | func save() { 53 | if let value = Int(self.valueLabel.text!) { 54 | self.counter?.value = value as NSNumber? 55 | CoreDataStorage.saveContext(self.context) 56 | } 57 | } 58 | 59 | // MARK: - Actions 60 | 61 | @IBAction func incrementButtonAction(_ sender: UIButton) { 62 | if let value = Int(self.valueLabel.text!) { 63 | counter?.value = (value + 1) as NSNumber? 64 | } 65 | 66 | updateUI() 67 | save() 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/1.png -------------------------------------------------------------------------------- /screenshots/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/10.png -------------------------------------------------------------------------------- /screenshots/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/11.png -------------------------------------------------------------------------------- /screenshots/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/12.png -------------------------------------------------------------------------------- /screenshots/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/13.png -------------------------------------------------------------------------------- /screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/2.png -------------------------------------------------------------------------------- /screenshots/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/3.png -------------------------------------------------------------------------------- /screenshots/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/4.png -------------------------------------------------------------------------------- /screenshots/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/5.png -------------------------------------------------------------------------------- /screenshots/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/6.png -------------------------------------------------------------------------------- /screenshots/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/7.png -------------------------------------------------------------------------------- /screenshots/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/8.png -------------------------------------------------------------------------------- /screenshots/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/iOS-Shared-CoreData-Storage-for-App-Groups/c2b30a58c93ed650412076b94ea79a21003e216b/screenshots/9.png --------------------------------------------------------------------------------