├── .gitignore ├── LICENSE ├── README.md ├── SwiftNote.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── SwiftNote ├── AppDelegate.swift ├── Base.lproj │ └── Main.storyboard ├── Constants.swift ├── CoreDataProvider.swift ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── Info.plist ├── Note.swift ├── NoteDetailViewController.swift ├── NoteProtocol.swift ├── NotesTableViewCell.swift ├── NotesTableViewController.swift ├── SwiftNote.entitlements ├── SwiftNote.xcdatamodeld │ ├── .xccurrentversion │ └── SwiftNote.xcdatamodel │ │ └── contents └── SwiftNoteNavigationController.swift ├── SwiftNoteTests ├── Info.plist └── SwiftNoteTests.swift └── SwiftNoteTodayWidget ├── Info.plist ├── MainInterface.storyboard ├── TodayTableViewCell.swift ├── TodayViewController.swift └── com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.entitlements /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | 20 | #CocoaPods 21 | #Pods 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 AppBrew LLC (http://www.appbrewllc.com/) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #SwiftNote 2 | 3 | Note taking app with recent notes today widget and iCloud syncing. Written in swift 4 | 5 | ##Things to watch out for with the today widget 6 | 7 | 1. Make sure to set the height using self.preferredContentSize 8 | 9 | ##Sharing data between the today widget and app 10 | 11 | 1. Add an app group through the entitlements screen for both the widget and the app 12 | 2. Make sure to specify the same group for each 13 | 3. Make the core data store url exist in the app group's shared container: 14 | 15 | ``` 16 | var storeURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier(kAppGroupIdentifier) 17 | storeURL = storeURL.URLByAppendingPathComponent("SwiftNote.sqlite"); 18 | ``` 19 | 20 | 4. Use this storeURL in both the today widget and app 21 | 22 | ##Debugging the today widget 23 | 24 | 1. Run the container app (SwiftNote) after making any changes 25 | 2. Stop debugging 26 | 3. In menu bar select Debug -> Attach to process -> By Process Identifier or Name 27 | 4. Attach to the process com.appbrewllc.SwiftNote.SwiftNoteTodayWidget 28 | 5. Breakpoint all the things! 29 | 30 | ##iCloud syncing 31 | 32 | This is currently not working. If anyone knows how to get this working please let me know 33 | 34 | -------------------------------------------------------------------------------- /SwiftNote.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 660F9719194C0EA3009D2ED5 /* SwiftNote.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 6640500D193E879D00428301 /* SwiftNote.xcdatamodeld */; }; 11 | 660F9720194C1F88009D2ED5 /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 660F971E194C1F88009D2ED5 /* TodayViewController.swift */; }; 12 | 660F9721194C1F88009D2ED5 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 660F971F194C1F88009D2ED5 /* MainInterface.storyboard */; }; 13 | 660F9723194D3345009D2ED5 /* TodayTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 660F9722194D3345009D2ED5 /* TodayTableViewCell.swift */; }; 14 | 6640500C193E879D00428301 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6640500B193E879D00428301 /* AppDelegate.swift */; }; 15 | 6640500F193E879D00428301 /* SwiftNote.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 6640500D193E879D00428301 /* SwiftNote.xcdatamodeld */; }; 16 | 66405014193E879D00428301 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66405012193E879D00428301 /* Main.storyboard */; }; 17 | 66405016193E879D00428301 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66405015193E879D00428301 /* Images.xcassets */; }; 18 | 66405022193E879D00428301 /* SwiftNoteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66405021193E879D00428301 /* SwiftNoteTests.swift */; }; 19 | 66405035193E8EF100428301 /* Note.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66405034193E8EF100428301 /* Note.swift */; }; 20 | 66405037193E905500428301 /* SwiftNoteNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66405036193E905500428301 /* SwiftNoteNavigationController.swift */; }; 21 | 66405039193E910C00428301 /* NotesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66405038193E910C00428301 /* NotesTableViewController.swift */; }; 22 | 6640503B193E966800428301 /* NoteDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6640503A193E966800428301 /* NoteDetailViewController.swift */; }; 23 | 6640503E193E971C00428301 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6640503D193E971C00428301 /* Constants.swift */; }; 24 | 66405040193ED49600428301 /* NoteProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6640503F193ED49600428301 /* NoteProtocol.swift */; }; 25 | 66405043193EEF2700428301 /* NotesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66405042193EEF2700428301 /* NotesTableViewCell.swift */; }; 26 | 666EB8AE1941B1B200733680 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 666EB8AD1941B1B200733680 /* NotificationCenter.framework */; }; 27 | 666EB8B81941B1B200733680 /* com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 666EB8AB1941B1B200733680 /* com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.appex */; }; 28 | 666EB8CA1942417500733680 /* Note.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66405034193E8EF100428301 /* Note.swift */; }; 29 | 666EB8CB1942417800733680 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6640503D193E971C00428301 /* Constants.swift */; }; 30 | 666EB8CC1942417A00733680 /* NoteProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6640503F193ED49600428301 /* NoteProtocol.swift */; }; 31 | 66B045BD19495C1400092238 /* CoreDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66B045BC19495C1400092238 /* CoreDataProvider.swift */; }; 32 | 66B045BE19495C1400092238 /* CoreDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66B045BC19495C1400092238 /* CoreDataProvider.swift */; }; 33 | /* End PBXBuildFile section */ 34 | 35 | /* Begin PBXContainerItemProxy section */ 36 | 6640501C193E879D00428301 /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = 66404FFE193E879D00428301 /* Project object */; 39 | proxyType = 1; 40 | remoteGlobalIDString = 66405005193E879D00428301; 41 | remoteInfo = SwiftNote; 42 | }; 43 | 666EB8B61941B1B200733680 /* PBXContainerItemProxy */ = { 44 | isa = PBXContainerItemProxy; 45 | containerPortal = 66404FFE193E879D00428301 /* Project object */; 46 | proxyType = 1; 47 | remoteGlobalIDString = 666EB8AA1941B1B200733680; 48 | remoteInfo = SwiftNoteTodayWidget; 49 | }; 50 | 666EB8B91941B1B200733680 /* PBXContainerItemProxy */ = { 51 | isa = PBXContainerItemProxy; 52 | containerPortal = 66404FFE193E879D00428301 /* Project object */; 53 | proxyType = 1; 54 | remoteGlobalIDString = 666EB8AA1941B1B200733680; 55 | remoteInfo = SwiftNoteTodayWidget; 56 | }; 57 | 666EB8BF1941B1C000733680 /* PBXContainerItemProxy */ = { 58 | isa = PBXContainerItemProxy; 59 | containerPortal = 66404FFE193E879D00428301 /* Project object */; 60 | proxyType = 1; 61 | remoteGlobalIDString = 66405005193E879D00428301; 62 | remoteInfo = SwiftNote; 63 | }; 64 | 666EB8C11941B1C000733680 /* PBXContainerItemProxy */ = { 65 | isa = PBXContainerItemProxy; 66 | containerPortal = 66404FFE193E879D00428301 /* Project object */; 67 | proxyType = 1; 68 | remoteGlobalIDString = 66405005193E879D00428301; 69 | remoteInfo = SwiftNote; 70 | }; 71 | /* End PBXContainerItemProxy section */ 72 | 73 | /* Begin PBXCopyFilesBuildPhase section */ 74 | 666EB8BE1941B1B200733680 /* Embed App Extensions */ = { 75 | isa = PBXCopyFilesBuildPhase; 76 | buildActionMask = 2147483647; 77 | dstPath = ""; 78 | dstSubfolderSpec = 13; 79 | files = ( 80 | 666EB8B81941B1B200733680 /* com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.appex in Embed App Extensions */, 81 | ); 82 | name = "Embed App Extensions"; 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXCopyFilesBuildPhase section */ 86 | 87 | /* Begin PBXFileReference section */ 88 | 660F971E194C1F88009D2ED5 /* TodayViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = ""; }; 89 | 660F971F194C1F88009D2ED5 /* MainInterface.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MainInterface.storyboard; sourceTree = ""; }; 90 | 660F9722194D3345009D2ED5 /* TodayTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodayTableViewCell.swift; sourceTree = ""; }; 91 | 66405006193E879D00428301 /* SwiftNote.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftNote.app; sourceTree = BUILT_PRODUCTS_DIR; }; 92 | 6640500A193E879D00428301 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 93 | 6640500B193E879D00428301 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 94 | 6640500E193E879D00428301 /* SwiftNote.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = SwiftNote.xcdatamodel; sourceTree = ""; }; 95 | 66405013193E879D00428301 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 96 | 66405015193E879D00428301 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 97 | 6640501B193E879D00428301 /* SwiftNoteTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftNoteTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 98 | 66405020193E879D00428301 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 99 | 66405021193E879D00428301 /* SwiftNoteTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftNoteTests.swift; sourceTree = ""; }; 100 | 66405034193E8EF100428301 /* Note.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Note.swift; sourceTree = ""; }; 101 | 66405036193E905500428301 /* SwiftNoteNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftNoteNavigationController.swift; sourceTree = ""; }; 102 | 66405038193E910C00428301 /* NotesTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotesTableViewController.swift; sourceTree = ""; }; 103 | 6640503A193E966800428301 /* NoteDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoteDetailViewController.swift; sourceTree = ""; }; 104 | 6640503D193E971C00428301 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; 105 | 6640503F193ED49600428301 /* NoteProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoteProtocol.swift; sourceTree = ""; }; 106 | 66405042193EEF2700428301 /* NotesTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotesTableViewCell.swift; sourceTree = ""; }; 107 | 666EB8A419419F9800733680 /* SwiftNote.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = SwiftNote.entitlements; sourceTree = ""; }; 108 | 666EB8AB1941B1B200733680 /* com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 109 | 666EB8AD1941B1B200733680 /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; 110 | 666EB8B11941B1B200733680 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 111 | 66B045BC19495C1400092238 /* CoreDataProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataProvider.swift; sourceTree = ""; }; 112 | 66B045BF1949648200092238 /* com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.entitlements; sourceTree = ""; }; 113 | /* End PBXFileReference section */ 114 | 115 | /* Begin PBXFrameworksBuildPhase section */ 116 | 66405003193E879D00428301 /* Frameworks */ = { 117 | isa = PBXFrameworksBuildPhase; 118 | buildActionMask = 2147483647; 119 | files = ( 120 | ); 121 | runOnlyForDeploymentPostprocessing = 0; 122 | }; 123 | 66405018193E879D00428301 /* Frameworks */ = { 124 | isa = PBXFrameworksBuildPhase; 125 | buildActionMask = 2147483647; 126 | files = ( 127 | ); 128 | runOnlyForDeploymentPostprocessing = 0; 129 | }; 130 | 666EB8A81941B1B200733680 /* Frameworks */ = { 131 | isa = PBXFrameworksBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | 666EB8AE1941B1B200733680 /* NotificationCenter.framework in Frameworks */, 135 | ); 136 | runOnlyForDeploymentPostprocessing = 0; 137 | }; 138 | /* End PBXFrameworksBuildPhase section */ 139 | 140 | /* Begin PBXGroup section */ 141 | 66404FFD193E879D00428301 = { 142 | isa = PBXGroup; 143 | children = ( 144 | 666EB8C7194240E300733680 /* Common */, 145 | 66405008193E879D00428301 /* SwiftNote */, 146 | 6640501E193E879D00428301 /* SwiftNoteTests */, 147 | 666EB8AF1941B1B200733680 /* SwiftNoteTodayWidget */, 148 | 666EB8AC1941B1B200733680 /* Frameworks */, 149 | 66405007193E879D00428301 /* Products */, 150 | ); 151 | sourceTree = ""; 152 | }; 153 | 66405007193E879D00428301 /* Products */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 66405006193E879D00428301 /* SwiftNote.app */, 157 | 6640501B193E879D00428301 /* SwiftNoteTests.xctest */, 158 | 666EB8AB1941B1B200733680 /* com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.appex */, 159 | ); 160 | name = Products; 161 | sourceTree = ""; 162 | }; 163 | 66405008193E879D00428301 /* SwiftNote */ = { 164 | isa = PBXGroup; 165 | children = ( 166 | 6640500B193E879D00428301 /* AppDelegate.swift */, 167 | 6640500D193E879D00428301 /* SwiftNote.xcdatamodeld */, 168 | 6640502B193E8D8800428301 /* Controllers */, 169 | 6640502F193E8E0000428301 /* Views */, 170 | 66405015193E879D00428301 /* Images.xcassets */, 171 | 66405009193E879D00428301 /* Supporting Files */, 172 | ); 173 | path = SwiftNote; 174 | sourceTree = ""; 175 | }; 176 | 66405009193E879D00428301 /* Supporting Files */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | 6640500A193E879D00428301 /* Info.plist */, 180 | 666EB8A419419F9800733680 /* SwiftNote.entitlements */, 181 | ); 182 | name = "Supporting Files"; 183 | sourceTree = ""; 184 | }; 185 | 6640501E193E879D00428301 /* SwiftNoteTests */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | 66405021193E879D00428301 /* SwiftNoteTests.swift */, 189 | 6640501F193E879D00428301 /* Supporting Files */, 190 | ); 191 | path = SwiftNoteTests; 192 | sourceTree = ""; 193 | }; 194 | 6640501F193E879D00428301 /* Supporting Files */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | 66405020193E879D00428301 /* Info.plist */, 198 | ); 199 | name = "Supporting Files"; 200 | sourceTree = ""; 201 | }; 202 | 6640502B193E8D8800428301 /* Controllers */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | 6640503A193E966800428301 /* NoteDetailViewController.swift */, 206 | 66405038193E910C00428301 /* NotesTableViewController.swift */, 207 | 66405036193E905500428301 /* SwiftNoteNavigationController.swift */, 208 | ); 209 | name = Controllers; 210 | sourceTree = ""; 211 | }; 212 | 6640502D193E8DF200428301 /* Models */ = { 213 | isa = PBXGroup; 214 | children = ( 215 | 66405034193E8EF100428301 /* Note.swift */, 216 | ); 217 | name = Models; 218 | path = SwiftNote; 219 | sourceTree = ""; 220 | }; 221 | 6640502E193E8DF900428301 /* Protocols */ = { 222 | isa = PBXGroup; 223 | children = ( 224 | 6640503F193ED49600428301 /* NoteProtocol.swift */, 225 | ); 226 | name = Protocols; 227 | path = SwiftNote; 228 | sourceTree = ""; 229 | }; 230 | 6640502F193E8E0000428301 /* Views */ = { 231 | isa = PBXGroup; 232 | children = ( 233 | 66405012193E879D00428301 /* Main.storyboard */, 234 | 66405042193EEF2700428301 /* NotesTableViewCell.swift */, 235 | ); 236 | name = Views; 237 | sourceTree = ""; 238 | }; 239 | 6640503C193E96FE00428301 /* Other */ = { 240 | isa = PBXGroup; 241 | children = ( 242 | 6640503D193E971C00428301 /* Constants.swift */, 243 | 66B045BC19495C1400092238 /* CoreDataProvider.swift */, 244 | ); 245 | name = Other; 246 | path = SwiftNote; 247 | sourceTree = ""; 248 | }; 249 | 666EB8AC1941B1B200733680 /* Frameworks */ = { 250 | isa = PBXGroup; 251 | children = ( 252 | 666EB8AD1941B1B200733680 /* NotificationCenter.framework */, 253 | ); 254 | name = Frameworks; 255 | sourceTree = ""; 256 | }; 257 | 666EB8AF1941B1B200733680 /* SwiftNoteTodayWidget */ = { 258 | isa = PBXGroup; 259 | children = ( 260 | 66B045BF1949648200092238 /* com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.entitlements */, 261 | 660F971F194C1F88009D2ED5 /* MainInterface.storyboard */, 262 | 660F9722194D3345009D2ED5 /* TodayTableViewCell.swift */, 263 | 660F971E194C1F88009D2ED5 /* TodayViewController.swift */, 264 | 666EB8B01941B1B200733680 /* Supporting Files */, 265 | ); 266 | path = SwiftNoteTodayWidget; 267 | sourceTree = ""; 268 | }; 269 | 666EB8B01941B1B200733680 /* Supporting Files */ = { 270 | isa = PBXGroup; 271 | children = ( 272 | 666EB8B11941B1B200733680 /* Info.plist */, 273 | ); 274 | name = "Supporting Files"; 275 | sourceTree = ""; 276 | }; 277 | 666EB8C7194240E300733680 /* Common */ = { 278 | isa = PBXGroup; 279 | children = ( 280 | 6640502D193E8DF200428301 /* Models */, 281 | 6640503C193E96FE00428301 /* Other */, 282 | 6640502E193E8DF900428301 /* Protocols */, 283 | ); 284 | name = Common; 285 | sourceTree = ""; 286 | }; 287 | /* End PBXGroup section */ 288 | 289 | /* Begin PBXNativeTarget section */ 290 | 66405005193E879D00428301 /* SwiftNote */ = { 291 | isa = PBXNativeTarget; 292 | buildConfigurationList = 66405025193E879D00428301 /* Build configuration list for PBXNativeTarget "SwiftNote" */; 293 | buildPhases = ( 294 | 66405002193E879D00428301 /* Sources */, 295 | 66405003193E879D00428301 /* Frameworks */, 296 | 66405004193E879D00428301 /* Resources */, 297 | 666EB8BE1941B1B200733680 /* Embed App Extensions */, 298 | ); 299 | buildRules = ( 300 | ); 301 | dependencies = ( 302 | 666EB8B71941B1B200733680 /* PBXTargetDependency */, 303 | 666EB8BA1941B1B200733680 /* PBXTargetDependency */, 304 | ); 305 | name = SwiftNote; 306 | productName = SwiftNote; 307 | productReference = 66405006193E879D00428301 /* SwiftNote.app */; 308 | productType = "com.apple.product-type.application"; 309 | }; 310 | 6640501A193E879D00428301 /* SwiftNoteTests */ = { 311 | isa = PBXNativeTarget; 312 | buildConfigurationList = 66405028193E879D00428301 /* Build configuration list for PBXNativeTarget "SwiftNoteTests" */; 313 | buildPhases = ( 314 | 66405017193E879D00428301 /* Sources */, 315 | 66405018193E879D00428301 /* Frameworks */, 316 | 66405019193E879D00428301 /* Resources */, 317 | ); 318 | buildRules = ( 319 | ); 320 | dependencies = ( 321 | 6640501D193E879D00428301 /* PBXTargetDependency */, 322 | 666EB8C01941B1C000733680 /* PBXTargetDependency */, 323 | 666EB8C21941B1C000733680 /* PBXTargetDependency */, 324 | ); 325 | name = SwiftNoteTests; 326 | productName = SwiftNoteTests; 327 | productReference = 6640501B193E879D00428301 /* SwiftNoteTests.xctest */; 328 | productType = "com.apple.product-type.bundle.unit-test"; 329 | }; 330 | 666EB8AA1941B1B200733680 /* SwiftNoteTodayWidget */ = { 331 | isa = PBXNativeTarget; 332 | buildConfigurationList = 666EB8BB1941B1B200733680 /* Build configuration list for PBXNativeTarget "SwiftNoteTodayWidget" */; 333 | buildPhases = ( 334 | 666EB8A71941B1B200733680 /* Sources */, 335 | 666EB8A81941B1B200733680 /* Frameworks */, 336 | 666EB8A91941B1B200733680 /* Resources */, 337 | ); 338 | buildRules = ( 339 | ); 340 | dependencies = ( 341 | ); 342 | name = SwiftNoteTodayWidget; 343 | productName = SwiftNoteTodayWidget; 344 | productReference = 666EB8AB1941B1B200733680 /* com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.appex */; 345 | productType = "com.apple.product-type.app-extension"; 346 | }; 347 | /* End PBXNativeTarget section */ 348 | 349 | /* Begin PBXProject section */ 350 | 66404FFE193E879D00428301 /* Project object */ = { 351 | isa = PBXProject; 352 | attributes = { 353 | LastUpgradeCheck = 0600; 354 | ORGANIZATIONNAME = "Matt Lathrop"; 355 | TargetAttributes = { 356 | 66405005193E879D00428301 = { 357 | CreatedOnToolsVersion = 6.0; 358 | DevelopmentTeam = U379US498J; 359 | SystemCapabilities = { 360 | com.apple.iCloud = { 361 | enabled = 1; 362 | }; 363 | com.apple.iOS = { 364 | enabled = 1; 365 | }; 366 | }; 367 | }; 368 | 6640501A193E879D00428301 = { 369 | CreatedOnToolsVersion = 6.0; 370 | TestTargetID = 66405005193E879D00428301; 371 | }; 372 | 666EB8AA1941B1B200733680 = { 373 | CreatedOnToolsVersion = 6.0; 374 | DevelopmentTeam = U379US498J; 375 | SystemCapabilities = { 376 | com.apple.iOS = { 377 | enabled = 1; 378 | }; 379 | }; 380 | }; 381 | }; 382 | }; 383 | buildConfigurationList = 66405001193E879D00428301 /* Build configuration list for PBXProject "SwiftNote" */; 384 | compatibilityVersion = "Xcode 3.2"; 385 | developmentRegion = English; 386 | hasScannedForEncodings = 0; 387 | knownRegions = ( 388 | en, 389 | Base, 390 | ); 391 | mainGroup = 66404FFD193E879D00428301; 392 | productRefGroup = 66405007193E879D00428301 /* Products */; 393 | projectDirPath = ""; 394 | projectRoot = ""; 395 | targets = ( 396 | 66405005193E879D00428301 /* SwiftNote */, 397 | 6640501A193E879D00428301 /* SwiftNoteTests */, 398 | 666EB8AA1941B1B200733680 /* SwiftNoteTodayWidget */, 399 | ); 400 | }; 401 | /* End PBXProject section */ 402 | 403 | /* Begin PBXResourcesBuildPhase section */ 404 | 66405004193E879D00428301 /* Resources */ = { 405 | isa = PBXResourcesBuildPhase; 406 | buildActionMask = 2147483647; 407 | files = ( 408 | 66405014193E879D00428301 /* Main.storyboard in Resources */, 409 | 66405016193E879D00428301 /* Images.xcassets in Resources */, 410 | ); 411 | runOnlyForDeploymentPostprocessing = 0; 412 | }; 413 | 66405019193E879D00428301 /* Resources */ = { 414 | isa = PBXResourcesBuildPhase; 415 | buildActionMask = 2147483647; 416 | files = ( 417 | ); 418 | runOnlyForDeploymentPostprocessing = 0; 419 | }; 420 | 666EB8A91941B1B200733680 /* Resources */ = { 421 | isa = PBXResourcesBuildPhase; 422 | buildActionMask = 2147483647; 423 | files = ( 424 | 660F9721194C1F88009D2ED5 /* MainInterface.storyboard in Resources */, 425 | ); 426 | runOnlyForDeploymentPostprocessing = 0; 427 | }; 428 | /* End PBXResourcesBuildPhase section */ 429 | 430 | /* Begin PBXSourcesBuildPhase section */ 431 | 66405002193E879D00428301 /* Sources */ = { 432 | isa = PBXSourcesBuildPhase; 433 | buildActionMask = 2147483647; 434 | files = ( 435 | 6640500C193E879D00428301 /* AppDelegate.swift in Sources */, 436 | 66405037193E905500428301 /* SwiftNoteNavigationController.swift in Sources */, 437 | 6640500F193E879D00428301 /* SwiftNote.xcdatamodeld in Sources */, 438 | 66405035193E8EF100428301 /* Note.swift in Sources */, 439 | 6640503E193E971C00428301 /* Constants.swift in Sources */, 440 | 66405040193ED49600428301 /* NoteProtocol.swift in Sources */, 441 | 66405039193E910C00428301 /* NotesTableViewController.swift in Sources */, 442 | 6640503B193E966800428301 /* NoteDetailViewController.swift in Sources */, 443 | 66405043193EEF2700428301 /* NotesTableViewCell.swift in Sources */, 444 | 66B045BD19495C1400092238 /* CoreDataProvider.swift in Sources */, 445 | ); 446 | runOnlyForDeploymentPostprocessing = 0; 447 | }; 448 | 66405017193E879D00428301 /* Sources */ = { 449 | isa = PBXSourcesBuildPhase; 450 | buildActionMask = 2147483647; 451 | files = ( 452 | 66405022193E879D00428301 /* SwiftNoteTests.swift in Sources */, 453 | ); 454 | runOnlyForDeploymentPostprocessing = 0; 455 | }; 456 | 666EB8A71941B1B200733680 /* Sources */ = { 457 | isa = PBXSourcesBuildPhase; 458 | buildActionMask = 2147483647; 459 | files = ( 460 | 666EB8CB1942417800733680 /* Constants.swift in Sources */, 461 | 660F9719194C0EA3009D2ED5 /* SwiftNote.xcdatamodeld in Sources */, 462 | 660F9720194C1F88009D2ED5 /* TodayViewController.swift in Sources */, 463 | 660F9723194D3345009D2ED5 /* TodayTableViewCell.swift in Sources */, 464 | 66B045BE19495C1400092238 /* CoreDataProvider.swift in Sources */, 465 | 666EB8CA1942417500733680 /* Note.swift in Sources */, 466 | 666EB8CC1942417A00733680 /* NoteProtocol.swift in Sources */, 467 | ); 468 | runOnlyForDeploymentPostprocessing = 0; 469 | }; 470 | /* End PBXSourcesBuildPhase section */ 471 | 472 | /* Begin PBXTargetDependency section */ 473 | 6640501D193E879D00428301 /* PBXTargetDependency */ = { 474 | isa = PBXTargetDependency; 475 | target = 66405005193E879D00428301 /* SwiftNote */; 476 | targetProxy = 6640501C193E879D00428301 /* PBXContainerItemProxy */; 477 | }; 478 | 666EB8B71941B1B200733680 /* PBXTargetDependency */ = { 479 | isa = PBXTargetDependency; 480 | target = 666EB8AA1941B1B200733680 /* SwiftNoteTodayWidget */; 481 | targetProxy = 666EB8B61941B1B200733680 /* PBXContainerItemProxy */; 482 | }; 483 | 666EB8BA1941B1B200733680 /* PBXTargetDependency */ = { 484 | isa = PBXTargetDependency; 485 | target = 666EB8AA1941B1B200733680 /* SwiftNoteTodayWidget */; 486 | targetProxy = 666EB8B91941B1B200733680 /* PBXContainerItemProxy */; 487 | }; 488 | 666EB8C01941B1C000733680 /* PBXTargetDependency */ = { 489 | isa = PBXTargetDependency; 490 | target = 66405005193E879D00428301 /* SwiftNote */; 491 | targetProxy = 666EB8BF1941B1C000733680 /* PBXContainerItemProxy */; 492 | }; 493 | 666EB8C21941B1C000733680 /* PBXTargetDependency */ = { 494 | isa = PBXTargetDependency; 495 | target = 66405005193E879D00428301 /* SwiftNote */; 496 | targetProxy = 666EB8C11941B1C000733680 /* PBXContainerItemProxy */; 497 | }; 498 | /* End PBXTargetDependency section */ 499 | 500 | /* Begin PBXVariantGroup section */ 501 | 66405012193E879D00428301 /* Main.storyboard */ = { 502 | isa = PBXVariantGroup; 503 | children = ( 504 | 66405013193E879D00428301 /* Base */, 505 | ); 506 | name = Main.storyboard; 507 | sourceTree = ""; 508 | }; 509 | /* End PBXVariantGroup section */ 510 | 511 | /* Begin XCBuildConfiguration section */ 512 | 66405023193E879D00428301 /* Debug */ = { 513 | isa = XCBuildConfiguration; 514 | buildSettings = { 515 | ALWAYS_SEARCH_USER_PATHS = NO; 516 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 517 | CLANG_CXX_LIBRARY = "libc++"; 518 | CLANG_ENABLE_MODULES = YES; 519 | CLANG_ENABLE_OBJC_ARC = YES; 520 | CLANG_WARN_BOOL_CONVERSION = YES; 521 | CLANG_WARN_CONSTANT_CONVERSION = YES; 522 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 523 | CLANG_WARN_EMPTY_BODY = YES; 524 | CLANG_WARN_ENUM_CONVERSION = YES; 525 | CLANG_WARN_INT_CONVERSION = YES; 526 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 527 | CLANG_WARN_UNREACHABLE_CODE = YES; 528 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 529 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 530 | COPY_PHASE_STRIP = NO; 531 | ENABLE_STRICT_OBJC_MSGSEND = YES; 532 | GCC_C_LANGUAGE_STANDARD = gnu99; 533 | GCC_DYNAMIC_NO_PIC = NO; 534 | GCC_OPTIMIZATION_LEVEL = 0; 535 | GCC_PREPROCESSOR_DEFINITIONS = ( 536 | "DEBUG=1", 537 | "$(inherited)", 538 | ); 539 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 540 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 541 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 542 | GCC_WARN_UNDECLARED_SELECTOR = YES; 543 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 544 | GCC_WARN_UNUSED_FUNCTION = YES; 545 | GCC_WARN_UNUSED_VARIABLE = YES; 546 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 547 | METAL_ENABLE_DEBUG_INFO = YES; 548 | ONLY_ACTIVE_ARCH = YES; 549 | SDKROOT = iphoneos; 550 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 551 | }; 552 | name = Debug; 553 | }; 554 | 66405024193E879D00428301 /* Release */ = { 555 | isa = XCBuildConfiguration; 556 | buildSettings = { 557 | ALWAYS_SEARCH_USER_PATHS = NO; 558 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 559 | CLANG_CXX_LIBRARY = "libc++"; 560 | CLANG_ENABLE_MODULES = YES; 561 | CLANG_ENABLE_OBJC_ARC = YES; 562 | CLANG_WARN_BOOL_CONVERSION = YES; 563 | CLANG_WARN_CONSTANT_CONVERSION = YES; 564 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 565 | CLANG_WARN_EMPTY_BODY = YES; 566 | CLANG_WARN_ENUM_CONVERSION = YES; 567 | CLANG_WARN_INT_CONVERSION = YES; 568 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 569 | CLANG_WARN_UNREACHABLE_CODE = YES; 570 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 571 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 572 | COPY_PHASE_STRIP = YES; 573 | ENABLE_NS_ASSERTIONS = NO; 574 | ENABLE_STRICT_OBJC_MSGSEND = YES; 575 | GCC_C_LANGUAGE_STANDARD = gnu99; 576 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 577 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 578 | GCC_WARN_UNDECLARED_SELECTOR = YES; 579 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 580 | GCC_WARN_UNUSED_FUNCTION = YES; 581 | GCC_WARN_UNUSED_VARIABLE = YES; 582 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 583 | METAL_ENABLE_DEBUG_INFO = NO; 584 | SDKROOT = iphoneos; 585 | VALIDATE_PRODUCT = YES; 586 | }; 587 | name = Release; 588 | }; 589 | 66405026193E879D00428301 /* Debug */ = { 590 | isa = XCBuildConfiguration; 591 | buildSettings = { 592 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 593 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 594 | CLANG_ENABLE_MODULES = YES; 595 | CODE_SIGN_ENTITLEMENTS = SwiftNote/SwiftNote.entitlements; 596 | CODE_SIGN_IDENTITY = "iPhone Developer"; 597 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 598 | INFOPLIST_FILE = SwiftNote/Info.plist; 599 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 600 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 601 | PRODUCT_NAME = "$(TARGET_NAME)"; 602 | PROVISIONING_PROFILE = ""; 603 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 604 | }; 605 | name = Debug; 606 | }; 607 | 66405027193E879D00428301 /* Release */ = { 608 | isa = XCBuildConfiguration; 609 | buildSettings = { 610 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 611 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 612 | CLANG_ENABLE_MODULES = YES; 613 | CODE_SIGN_ENTITLEMENTS = SwiftNote/SwiftNote.entitlements; 614 | CODE_SIGN_IDENTITY = "iPhone Developer"; 615 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 616 | INFOPLIST_FILE = SwiftNote/Info.plist; 617 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 618 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 619 | PRODUCT_NAME = "$(TARGET_NAME)"; 620 | PROVISIONING_PROFILE = ""; 621 | }; 622 | name = Release; 623 | }; 624 | 66405029193E879D00428301 /* Debug */ = { 625 | isa = XCBuildConfiguration; 626 | buildSettings = { 627 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SwiftNote.app/SwiftNote"; 628 | FRAMEWORK_SEARCH_PATHS = ( 629 | "$(SDKROOT)/Developer/Library/Frameworks", 630 | "$(inherited)", 631 | ); 632 | GCC_PREPROCESSOR_DEFINITIONS = ( 633 | "DEBUG=1", 634 | "$(inherited)", 635 | ); 636 | INFOPLIST_FILE = SwiftNoteTests/Info.plist; 637 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 638 | METAL_ENABLE_DEBUG_INFO = YES; 639 | PRODUCT_NAME = "$(TARGET_NAME)"; 640 | TEST_HOST = "$(BUNDLE_LOADER)"; 641 | }; 642 | name = Debug; 643 | }; 644 | 6640502A193E879D00428301 /* Release */ = { 645 | isa = XCBuildConfiguration; 646 | buildSettings = { 647 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SwiftNote.app/SwiftNote"; 648 | FRAMEWORK_SEARCH_PATHS = ( 649 | "$(SDKROOT)/Developer/Library/Frameworks", 650 | "$(inherited)", 651 | ); 652 | INFOPLIST_FILE = SwiftNoteTests/Info.plist; 653 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 654 | METAL_ENABLE_DEBUG_INFO = NO; 655 | PRODUCT_NAME = "$(TARGET_NAME)"; 656 | TEST_HOST = "$(BUNDLE_LOADER)"; 657 | }; 658 | name = Release; 659 | }; 660 | 666EB8BC1941B1B200733680 /* Debug */ = { 661 | isa = XCBuildConfiguration; 662 | buildSettings = { 663 | CODE_SIGN_ENTITLEMENTS = SwiftNoteTodayWidget/com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.entitlements; 664 | CODE_SIGN_IDENTITY = "iPhone Developer"; 665 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 666 | GCC_PREPROCESSOR_DEFINITIONS = ( 667 | "DEBUG=1", 668 | "$(inherited)", 669 | ); 670 | INFOPLIST_FILE = SwiftNoteTodayWidget/Info.plist; 671 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 672 | METAL_ENABLE_DEBUG_INFO = YES; 673 | PRODUCT_NAME = "com.appbrewllc.SwiftNote.$(TARGET_NAME:rfc1034identifier)"; 674 | PROVISIONING_PROFILE = ""; 675 | SKIP_INSTALL = YES; 676 | }; 677 | name = Debug; 678 | }; 679 | 666EB8BD1941B1B200733680 /* Release */ = { 680 | isa = XCBuildConfiguration; 681 | buildSettings = { 682 | CODE_SIGN_ENTITLEMENTS = SwiftNoteTodayWidget/com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.entitlements; 683 | CODE_SIGN_IDENTITY = "iPhone Developer"; 684 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 685 | INFOPLIST_FILE = SwiftNoteTodayWidget/Info.plist; 686 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 687 | METAL_ENABLE_DEBUG_INFO = NO; 688 | PRODUCT_NAME = "com.appbrewllc.SwiftNote.$(TARGET_NAME:rfc1034identifier)"; 689 | PROVISIONING_PROFILE = ""; 690 | SKIP_INSTALL = YES; 691 | }; 692 | name = Release; 693 | }; 694 | /* End XCBuildConfiguration section */ 695 | 696 | /* Begin XCConfigurationList section */ 697 | 66405001193E879D00428301 /* Build configuration list for PBXProject "SwiftNote" */ = { 698 | isa = XCConfigurationList; 699 | buildConfigurations = ( 700 | 66405023193E879D00428301 /* Debug */, 701 | 66405024193E879D00428301 /* Release */, 702 | ); 703 | defaultConfigurationIsVisible = 0; 704 | defaultConfigurationName = Release; 705 | }; 706 | 66405025193E879D00428301 /* Build configuration list for PBXNativeTarget "SwiftNote" */ = { 707 | isa = XCConfigurationList; 708 | buildConfigurations = ( 709 | 66405026193E879D00428301 /* Debug */, 710 | 66405027193E879D00428301 /* Release */, 711 | ); 712 | defaultConfigurationIsVisible = 0; 713 | defaultConfigurationName = Release; 714 | }; 715 | 66405028193E879D00428301 /* Build configuration list for PBXNativeTarget "SwiftNoteTests" */ = { 716 | isa = XCConfigurationList; 717 | buildConfigurations = ( 718 | 66405029193E879D00428301 /* Debug */, 719 | 6640502A193E879D00428301 /* Release */, 720 | ); 721 | defaultConfigurationIsVisible = 0; 722 | defaultConfigurationName = Release; 723 | }; 724 | 666EB8BB1941B1B200733680 /* Build configuration list for PBXNativeTarget "SwiftNoteTodayWidget" */ = { 725 | isa = XCConfigurationList; 726 | buildConfigurations = ( 727 | 666EB8BC1941B1B200733680 /* Debug */, 728 | 666EB8BD1941B1B200733680 /* Release */, 729 | ); 730 | defaultConfigurationIsVisible = 0; 731 | defaultConfigurationName = Release; 732 | }; 733 | /* End XCConfigurationList section */ 734 | 735 | /* Begin XCVersionGroup section */ 736 | 6640500D193E879D00428301 /* SwiftNote.xcdatamodeld */ = { 737 | isa = XCVersionGroup; 738 | children = ( 739 | 6640500E193E879D00428301 /* SwiftNote.xcdatamodel */, 740 | ); 741 | currentVersion = 6640500E193E879D00428301 /* SwiftNote.xcdatamodel */; 742 | path = SwiftNote.xcdatamodeld; 743 | sourceTree = ""; 744 | versionGroupType = wrapper.xcdatamodel; 745 | }; 746 | /* End XCVersionGroup section */ 747 | }; 748 | rootObject = 66404FFE193E879D00428301 /* Project object */; 749 | } 750 | -------------------------------------------------------------------------------- /SwiftNote.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftNote/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftNote 4 | // 5 | // Created by AppBrew LLC (appbrewllc.com) on 6/3/14. 6 | // Copyright (c) 2014 Matt Lathrop. 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 | var coreDataProvider: CoreDataProvider? 17 | 18 | 19 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 20 | // Override point for customization after application launch. 21 | self.coreDataProvider = CoreDataProvider() 22 | 23 | return true 24 | } 25 | 26 | func applicationWillResignActive(application: UIApplication) { 27 | // 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. 28 | // 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. 29 | } 30 | 31 | func applicationDidEnterBackground(application: UIApplication) { 32 | // 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. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | func applicationWillEnterForeground(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationDidBecomeActive(application: UIApplication) { 41 | // 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. 42 | } 43 | 44 | func applicationWillTerminate(application: UIApplication) { 45 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 46 | // Saves changes in the application's managed object context before the application terminates. 47 | self.saveContext() 48 | } 49 | 50 | // #pragma mark - Core Data stack 51 | 52 | func saveContext () { 53 | self.coreDataProvider!.saveContext() 54 | } 55 | 56 | var managedObjectContext: NSManagedObjectContext { 57 | return self.coreDataProvider!.managedObjectContext 58 | } 59 | 60 | var managedObjectModel: NSManagedObjectModel { 61 | return self.coreDataProvider!.managedObjectModel 62 | } 63 | 64 | var persistentStoreCoordinator: NSPersistentStoreCoordinator { 65 | return self.coreDataProvider!.persistentStoreCoordinator 66 | } 67 | 68 | } 69 | 70 | -------------------------------------------------------------------------------- /SwiftNote/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 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 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /SwiftNote/Constants.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Constants.swift 3 | // SwiftNote 4 | // 5 | // Created by Matthew Lathrop on 6/3/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | let kAppGroupIdentifier = "group.swiftnote.appbrewllc.com" 12 | 13 | // Entity Names 14 | let kEntityNameNoteEntity = "NoteEntity" 15 | 16 | // Reuse Identifiers 17 | let kReuseIdentifierNotesTableViewCell = "ruid_notesTableViewCell" 18 | let kReuseIdentifierTodayTableViewCell = "ruid_todayViewCell" 19 | 20 | // Segue Identifiers 21 | let kSegueIdentifierNotesTableToNoteDetailAdd = "seg_notesTableToNoteDetail_add" 22 | let kSegueIdentifierNotesTableToNoteDetailEdit = "seg_notesTableToNoteDetail_edit" 23 | -------------------------------------------------------------------------------- /SwiftNote/CoreDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CoreDataProvider.swift 3 | // SwiftNote 4 | // 5 | // Created by Matthew Lathrop on 6/11/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import CoreData 10 | 11 | class CoreDataProvider: NSObject { 12 | 13 | var applicationDocumentsDirectory: NSURL! = { 14 | let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) 15 | return urls[urls.endIndex-1] as NSURL 16 | }() 17 | 18 | func saveContext () { 19 | var error: NSError? = nil 20 | let managedObjectContext = self.managedObjectContext 21 | if managedObjectContext.save(&error) { 22 | if managedObjectContext.hasChanges && !managedObjectContext.save(&error) { 23 | // Replace this implementation with code to handle the error appropriately. 24 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 25 | //println("Unresolved error \(error), \(error.userInfo)") 26 | abort() 27 | } 28 | } 29 | } 30 | 31 | // #pragma mark - Core Data stack 32 | 33 | // Returns the managed object context for the application. 34 | // If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application. 35 | var managedObjectContext: NSManagedObjectContext { 36 | if _managedObjectContext == nil { 37 | _managedObjectContext = NSManagedObjectContext(concurrencyType: NSManagedObjectContextConcurrencyType.MainQueueConcurrencyType) 38 | _managedObjectContext!.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy 39 | _managedObjectContext!.persistentStoreCoordinator = self.persistentStoreCoordinator 40 | } 41 | return _managedObjectContext! 42 | } 43 | var _managedObjectContext: NSManagedObjectContext? = nil 44 | 45 | // Returns the managed object model for the application. 46 | // If the model doesn't already exist, it is created from the application's model. 47 | var managedObjectModel: NSManagedObjectModel { 48 | if _managedObjectModel == nil { 49 | let modelURL = NSBundle.mainBundle().URLForResource("SwiftNote", withExtension: "momd") 50 | _managedObjectModel = NSManagedObjectModel(contentsOfURL: modelURL!) 51 | } 52 | return _managedObjectModel! 53 | } 54 | var _managedObjectModel: NSManagedObjectModel? = nil 55 | 56 | // Returns the persistent store coordinator for the application. 57 | // If the coordinator doesn't already exist, it is created and the application's store added to it. 58 | var persistentStoreCoordinator: NSPersistentStoreCoordinator { 59 | if _persistentStoreCoordinator == nil { 60 | 61 | // store url should point to the shared container 62 | var storeURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier(kAppGroupIdentifier) 63 | storeURL = storeURL?.URLByAppendingPathComponent("SwiftNote.sqlite") 64 | 65 | //store url if you don't want to make a shared container. 66 | //var storeURL = applicationDocumentsDirectory.URLByAppendingPathComponent("SwiftNote.sqlite") 67 | 68 | var error: NSError? = nil 69 | 70 | _persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel) 71 | 72 | var currentiCloudtoken = NSFileManager.defaultManager().ubiquityIdentityToken 73 | 74 | var options: NSDictionary? = nil 75 | if (currentiCloudtoken != nil) { 76 | let defaultCenter = NSNotificationCenter.defaultCenter() 77 | 78 | /* 79 | defaultCenter.addObserver(self, selector: "storesWillChange:", name: NSPersistentStoreCoordinatorStoresWillChangeNotification, object: _persistentStoreCoordinator) 80 | 81 | defaultCenter.addObserver(self, selector: "storesDidChange:", name: NSPersistentStoreCoordinatorStoresDidChangeNotification, object: _persistentStoreCoordinator) 82 | 83 | defaultCenter.addObserver(self, selector: "persistentStoreDidImportUbiquitousContentChanges:", name: NSPersistentStoreDidImportUbiquitousContentChangesNotification, object: _persistentStoreCoordinator) 84 | 85 | defaultCenter.addObserverForName(nil, object: nil, queue: nil, usingBlock: { (notification: NSNotification!) in 86 | println("$$$$$$$$$$\n\(notification.description)\n") 87 | }) 88 | */ 89 | 90 | options = [ NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingModelAutomaticallyOption: true, NSPersistentStoreUbiquitousContentNameKey: "SwiftNoteiCloudStore" ] 91 | } 92 | else { 93 | options = [ NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingModelAutomaticallyOption: true ] 94 | } 95 | 96 | if _persistentStoreCoordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: storeURL, options: nil, error: &error) == nil { 97 | /* 98 | Replace this implementation with code to handle the error appropriately. 99 | 100 | abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 101 | 102 | Typical reasons for an error here include: 103 | * The persistent store is not accessible; 104 | * The schema for the persistent store is incompatible with current managed object model. 105 | Check the error message to determine what the actual problem was. 106 | 107 | 108 | If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory. 109 | 110 | If you encounter schema incompatibility errors during development, you can reduce their frequency by: 111 | * Simply deleting the existing store: 112 | NSFileManager.defaultManager().removeItemAtURL(storeURL, error: nil) 113 | 114 | * Performing automatic lightweight migration by passing the following dictionary as the options parameter: 115 | [NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingModelAutomaticallyOption: true} 116 | 117 | Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details. 118 | 119 | */ 120 | println("Unresolved error \(error), \(error?.description)") 121 | abort() 122 | } 123 | } 124 | return _persistentStoreCoordinator! 125 | } 126 | var _persistentStoreCoordinator: NSPersistentStoreCoordinator? = nil 127 | 128 | // MARK - iCloud handling 129 | 130 | func persistentStoreDidImportUbiquitousContentChanges(notification: NSNotification!) { 131 | println("== persistentStoreDidImportUbiquitousContentChanges ==\n") 132 | println(notification.description) 133 | 134 | let context = self.managedObjectContext 135 | 136 | context.performBlock(({ 137 | context.mergeChangesFromContextDidSaveNotification(notification) 138 | })) 139 | } 140 | 141 | func storesWillChange(notification: NSNotification!) { 142 | println("== storesWillChange ==\n") 143 | println(notification.description) 144 | 145 | let context = self.managedObjectContext 146 | 147 | context.performBlockAndWait(({ 148 | var error: NSError? = nil 149 | 150 | if context.hasChanges { 151 | let success = context.save(&error) 152 | 153 | if (success == false && error != nil) { 154 | println(error!.localizedDescription) 155 | } 156 | } 157 | 158 | context.reset() 159 | })) 160 | } 161 | 162 | func storesDidChange(notification: NSNotification!) { 163 | println("== storesDidChange ==\n") 164 | println(notification.description) 165 | 166 | //TODO 167 | } 168 | 169 | //TODO: create coreDataDelegate protocl 170 | 171 | } 172 | -------------------------------------------------------------------------------- /SwiftNote/Images.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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SwiftNote/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SwiftNote/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.appbrewllc.${PRODUCT_NAME:rfc1034identifier} 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 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SwiftNote/Note.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Note.swift 3 | // SwiftNote 4 | // 5 | // Created by AppBrew LLC (appbrewllc.com) on 6/3/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import CoreData 10 | import UIKit 11 | 12 | class Note: NoteProtocol { 13 | var noteEntity: NSManagedObject? = nil 14 | 15 | var body: NSString? { 16 | get { 17 | return self.noteEntity!.valueForKey("body") as NSString! 18 | } 19 | set { 20 | self.noteEntity!.setValue(newValue, forKey: "body") 21 | } 22 | } 23 | 24 | var createdAt: NSDate? { 25 | get { 26 | return self.noteEntity!.valueForKey("createdAt") as NSDate! 27 | } 28 | set { 29 | self.noteEntity!.setValue(newValue, forKey: "createdAt") 30 | } 31 | } 32 | 33 | var entityId: NSString? { 34 | get { 35 | return self.noteEntity!.valueForKey("entityId") as NSString! 36 | } 37 | set { 38 | self.noteEntity!.setValue(newValue, forKey: "entityId") 39 | } 40 | } 41 | 42 | var modifiedAt: NSDate? { 43 | get { 44 | return self.noteEntity!.valueForKey("modifiedAt") as NSDate! 45 | } 46 | set { 47 | self.noteEntity!.setValue(newValue, forKey: "modifiedAt") 48 | } 49 | } 50 | 51 | var title: NSString? { 52 | get { 53 | return self.noteEntity!.valueForKey("title") as NSString! 54 | } 55 | set { 56 | self.noteEntity!.setValue(newValue, forKey: "title") 57 | } 58 | } 59 | 60 | class func insertNewNoteInManagedObjectContext(managedObjectContext: NSManagedObjectContext!) -> NoteProtocol { 61 | let note = Note() 62 | 63 | // create new entity 64 | note.noteEntity = NSEntityDescription.insertNewObjectForEntityForName(kEntityNameNoteEntity, inManagedObjectContext: managedObjectContext) as? NSManagedObject 65 | 66 | // set defaults 67 | note.createdAt = NSDate.init() 68 | note.modifiedAt = note.createdAt 69 | note.entityId = NSUUID.init().UUIDString 70 | 71 | return note 72 | } 73 | 74 | class func noteFromNoteEntity(noteEntity: NSManagedObject) -> NoteProtocol { 75 | let note = Note() 76 | note.noteEntity = noteEntity 77 | return note 78 | } 79 | 80 | func update(#title: String, body: String) { 81 | self.title = title; 82 | self.body = body; 83 | self.modifiedAt = NSDate.init() 84 | } 85 | 86 | func deleteInManagedObjectContext(managedObjectContext: NSManagedObjectContext!) { 87 | managedObjectContext.deleteObject(self.noteEntity!) 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SwiftNote/NoteDetailViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NoteDetailViewController.swift 3 | // SwiftNote 4 | // 5 | // Created by Matthew Lathrop on 6/3/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import CoreData 10 | import UIKit 11 | 12 | class NoteDetailViewController: UIViewController, UITextViewDelegate { 13 | 14 | // MARK: properties 15 | @IBOutlet var titleTextField: UITextField! 16 | 17 | @IBOutlet var bodyTextView: UITextView! 18 | 19 | @IBOutlet var tapToEditTextField: UITextField! 20 | 21 | var note: NoteProtocol? 22 | 23 | var saveNeeded: Bool 24 | 25 | // MARK: methods 26 | 27 | required init(coder aDecoder: NSCoder) { 28 | saveNeeded = false 29 | 30 | super.init(coder: aDecoder) 31 | } 32 | 33 | // MARK: view methods 34 | 35 | override func viewDidLoad() { 36 | super.viewDidLoad() 37 | 38 | // fix default content inset 39 | self.bodyTextView?.contentInset = UIEdgeInsetsMake(-10,-4,0,-4) 40 | 41 | self.configureView() 42 | } 43 | 44 | override func viewWillAppear(animated: Bool) { 45 | super.viewWillAppear(animated) 46 | 47 | // observe keyboard events 48 | NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow:", name: UIKeyboardWillShowNotification, object: nil) 49 | NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillHide:", name: UIKeyboardWillHideNotification, object: nil) 50 | } 51 | 52 | override func viewWillDisappear(animated: Bool) { 53 | super.viewWillDisappear(animated) 54 | 55 | self.updateNote() 56 | 57 | // remove keyboard observation 58 | NSNotificationCenter.defaultCenter().removeObserver(self, name:UIKeyboardWillShowNotification, object:nil) 59 | NSNotificationCenter.defaultCenter().removeObserver(self, name:UIKeyboardWillHideNotification, object:nil) 60 | } 61 | 62 | override func viewDidDisappear(animated: Bool) { 63 | super.viewDidDisappear(animated) 64 | 65 | if self.saveNeeded { 66 | (UIApplication.sharedApplication().delegate as AppDelegate).saveContext() 67 | } 68 | } 69 | 70 | func configureView() { 71 | if note != nil { 72 | // show the right bar button item 73 | //self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Action, target: self, action: "actionButtonTapped:") 74 | 75 | self.titleTextField.text = note?.title 76 | self.bodyTextView.text = note?.body 77 | } 78 | 79 | self.hideTapToEditLabelIfNeeded() 80 | } 81 | 82 | // MARK - textk view delegate methods 83 | 84 | func textViewDidBeginEditing(textView: UITextView!) { 85 | self.tapToEditTextField.hidden = true 86 | } 87 | 88 | func textViewDidEndEditing(textView: UITextView!) { 89 | self.tapToEditTextField.hidden = true 90 | } 91 | 92 | func textViewDidChange(textView: UITextView!) { 93 | self.showTextViewCaretPosition(textView) 94 | } 95 | 96 | func textViewDidChangeSelection(textView: UITextView!) { 97 | self.showTextViewCaretPosition(textView) 98 | } 99 | 100 | // MARK - keyboard notifications 101 | 102 | func keyboardWillShow(notification: NSNotification) { 103 | 104 | let frameValue = notification.userInfo![UIKeyboardFrameEndUserInfoKey] as NSValue 105 | let keyboardFrame = frameValue.CGRectValue() 106 | let animationDuration = notification.userInfo![UIKeyboardAnimationDurationUserInfoKey] as NSNumber 107 | 108 | let isPortrait = UIDeviceOrientationIsPortrait(UIDevice.currentDevice().orientation) 109 | let keyboardHeight = isPortrait ? keyboardFrame.size.height : keyboardFrame.size.width 110 | 111 | var contentInset = self.bodyTextView.contentInset 112 | contentInset.bottom = keyboardHeight 113 | 114 | var scrollIndicatorInsets = self.bodyTextView.scrollIndicatorInsets 115 | scrollIndicatorInsets.bottom = keyboardHeight 116 | 117 | UIView.animateWithDuration(animationDuration.doubleValue, animations:({ 118 | self.bodyTextView.contentInset = contentInset 119 | self.bodyTextView.scrollIndicatorInsets = scrollIndicatorInsets 120 | }) 121 | ) 122 | } 123 | 124 | func keyboardWillHide(notification: NSNotification) { 125 | let animationDuration = notification.userInfo![UIKeyboardAnimationDurationUserInfoKey] as NSNumber 126 | 127 | var contentInset = self.bodyTextView.contentInset 128 | contentInset.bottom = 0 129 | 130 | var scrollIndicatorInsets = self.bodyTextView.scrollIndicatorInsets 131 | scrollIndicatorInsets.bottom = 0 132 | 133 | UIView.animateWithDuration(animationDuration.doubleValue, animations:({ 134 | self.bodyTextView.contentInset = contentInset 135 | self.bodyTextView.scrollIndicatorInsets = scrollIndicatorInsets 136 | }) 137 | ) 138 | } 139 | 140 | // MARK - other methods 141 | 142 | func updateNote() { 143 | var trimmedTitle = self.titleTextField.text.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) 144 | var trimmedBody = self.bodyTextView.text.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) 145 | 146 | // delete note if both fields are blank 147 | if (note != nil && trimmedBody.isEmpty && trimmedTitle.isEmpty) { 148 | note!.deleteInManagedObjectContext((UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext) 149 | } 150 | 151 | // don't do anything if fields are empty 152 | if (trimmedBody.isEmpty && trimmedTitle.isEmpty) { 153 | return 154 | } 155 | 156 | // set default title if needed 157 | if trimmedTitle.isEmpty { 158 | trimmedTitle = "Untitled" 159 | } 160 | 161 | // set default body if needed 162 | if trimmedBody.isEmpty { 163 | trimmedBody = "New note" 164 | } 165 | 166 | // return if values are the same 167 | if (note != nil && self.note!.title == self.titleTextField.text && self.note!.body == self.bodyTextView.text) { 168 | return 169 | } 170 | 171 | // save is needed by this point 172 | self.saveNeeded = true 173 | 174 | if note == nil { 175 | note = Note.insertNewNoteInManagedObjectContext((UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext) 176 | } 177 | 178 | note?.update(title: trimmedTitle, body: trimmedBody) 179 | } 180 | 181 | override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) { 182 | self.showTextViewCaretPosition(self.bodyTextView) 183 | } 184 | 185 | func showTextViewCaretPosition(textView: UITextView!) { 186 | let caretRect = textView.caretRectForPosition(textView.selectedTextRange!.end) 187 | textView.scrollRectToVisible(caretRect, animated: false) 188 | } 189 | 190 | func hideTapToEditLabelIfNeeded() { 191 | if (self.bodyTextView.text.utf16Count > 0) { 192 | self.tapToEditTextField.hidden = true 193 | } 194 | else { 195 | self.tapToEditTextField.hidden = false 196 | } 197 | } 198 | 199 | func actionButtonTapped(sender: UIBarButtonItem!) { 200 | //TODO: 201 | // let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.White) 202 | // activityIndicator.startAnimating() 203 | // 204 | // self.navigationItem.rightBarButtonItem.customView = activityIndicator 205 | // 206 | // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ({ 207 | // let avd = UIActivityViewController(activityItems: "\(self.titleTextField.text)\(self.bodyTextView.text)", applicationActivities: nil) 208 | // })) 209 | } 210 | 211 | } 212 | -------------------------------------------------------------------------------- /SwiftNote/NoteProtocol.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NoteProtocol.swift 3 | // SwiftNote 4 | // 5 | // Created by Matthew Lathrop on 6/4/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import CoreData 10 | import Foundation 11 | 12 | protocol NoteProtocol { 13 | var body: NSString? { get set } 14 | var createdAt: NSDate? { get set } 15 | var entityId: NSString? { get set } 16 | var modifiedAt: NSDate? { get set } 17 | var title: NSString? { get set } 18 | 19 | // class methods 20 | class func insertNewNoteInManagedObjectContext(managedObjectContext: NSManagedObjectContext!) -> NoteProtocol 21 | class func noteFromNoteEntity(noteEntity: NSManagedObject) -> NoteProtocol 22 | 23 | // instance methods 24 | func update(#title: String, body: String) 25 | func deleteInManagedObjectContext(managedObjectContext: NSManagedObjectContext!) 26 | } 27 | -------------------------------------------------------------------------------- /SwiftNote/NotesTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotesTableViewCell.swift 3 | // SwiftNote 4 | // 5 | // Created by Matthew Lathrop on 6/4/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class NotesTableViewCell: UITableViewCell { 12 | 13 | @IBOutlet var titleLabel: UILabel! 14 | 15 | @IBOutlet var bodyLabel: UILabel! 16 | 17 | func configure(#note:NoteProtocol!, indexPath:NSIndexPath!) { 18 | self.titleLabel.text = note.title; 19 | self.bodyLabel.text = note.body; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftNote/NotesTableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotesTableViewController.swift 3 | // SwiftNote 4 | // 5 | // Created by AppBrew LLC (appbrewllc.com) on 6/3/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import CoreData 10 | import UIKit 11 | 12 | class NotesTableViewController: UITableViewController, NSFetchedResultsControllerDelegate { 13 | 14 | var managedObjectContext: NSManagedObjectContext { 15 | get { 16 | if !(_managedObjectContext != nil) { 17 | _managedObjectContext = (UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext 18 | } 19 | 20 | return _managedObjectContext! 21 | } 22 | } 23 | var _managedObjectContext: NSManagedObjectContext? = nil 24 | 25 | var fetchedResultsController: NSFetchedResultsController { 26 | get { 27 | if !(_fetchedResultsController != nil) { 28 | // set up fetch request 29 | var fetchRequest = NSFetchRequest() 30 | fetchRequest.entity = NSEntityDescription.entityForName(kEntityNameNoteEntity, inManagedObjectContext: (UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext) 31 | 32 | // sort by last updated 33 | var sortDescriptor = NSSortDescriptor(key: "modifiedAt", ascending: false) 34 | fetchRequest.sortDescriptors = [sortDescriptor] 35 | fetchRequest.fetchBatchSize = 20 36 | 37 | _fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: (UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext, sectionNameKeyPath: nil, cacheName: "allNotesCache") 38 | _fetchedResultsController!.delegate = self 39 | } 40 | 41 | return _fetchedResultsController!; 42 | } 43 | } 44 | var _fetchedResultsController: NSFetchedResultsController? = nil 45 | 46 | required init(coder aDecoder: NSCoder) { 47 | super.init(coder: aDecoder) 48 | } 49 | 50 | override func viewDidLoad() { 51 | super.viewDidLoad() 52 | 53 | self.fetchedResultsController.performFetch(nil) 54 | } 55 | 56 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { 57 | if (segue.identifier == kSegueIdentifierNotesTableToNoteDetailEdit) { 58 | let entity = self.fetchedResultsController.objectAtIndexPath(self.tableView.indexPathForSelectedRow()!) as NSManagedObject 59 | let note = Note.noteFromNoteEntity(entity) 60 | let viewController = segue.destinationViewController as NoteDetailViewController 61 | viewController.note = note 62 | } 63 | } 64 | 65 | // #pragma mark - Table view data source 66 | 67 | override func numberOfSectionsInTableView(tableView: UITableView?) -> Int { 68 | return self.fetchedResultsController.sections!.count 69 | } 70 | 71 | override func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -> Int { 72 | let sectionInfo = self.fetchedResultsController.sections?[section] as NSFetchedResultsSectionInfo 73 | return sectionInfo.numberOfObjects 74 | } 75 | 76 | override func tableView(_: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 77 | let cell = tableView.dequeueReusableCellWithIdentifier(kReuseIdentifierNotesTableViewCell, forIndexPath: indexPath) as NotesTableViewCell 78 | let entity = self.fetchedResultsController.objectAtIndexPath(indexPath) as NSManagedObject 79 | let note = Note.noteFromNoteEntity(entity) 80 | cell.configure(note: note, indexPath: indexPath) 81 | return cell 82 | } 83 | 84 | override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { 85 | return 70 86 | } 87 | 88 | override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { 89 | let entity = self.fetchedResultsController.objectAtIndexPath(indexPath) as NSManagedObject 90 | let note = Note.noteFromNoteEntity(entity) 91 | note.deleteInManagedObjectContext((UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext) 92 | (UIApplication.sharedApplication().delegate as AppDelegate).saveContext() 93 | } 94 | 95 | // MARK: - fetched results controller delegate 96 | 97 | func controllerWillChangeContent(controller: NSFetchedResultsController) { 98 | self.tableView.beginUpdates() 99 | } 100 | 101 | func controller(controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType) { 102 | switch type { 103 | case .Insert: 104 | self.tableView.insertSections(NSIndexSet(index: sectionIndex), withRowAnimation: .Fade) 105 | case .Delete: 106 | self.tableView.deleteSections(NSIndexSet(index: sectionIndex), withRowAnimation: .Fade) 107 | default: 108 | return 109 | } 110 | } 111 | 112 | func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath) { 113 | switch type { 114 | case .Insert: 115 | tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade) 116 | case .Delete: 117 | tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) 118 | case .Update: 119 | let cell = tableView.cellForRowAtIndexPath(indexPath) as NotesTableViewCell 120 | let note = self.fetchedResultsController.sections?[indexPath.section][indexPath.row] as Note 121 | cell.configure(note: note, indexPath: indexPath) 122 | case .Move: 123 | tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) 124 | tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade) 125 | default: 126 | return 127 | } 128 | } 129 | 130 | func controllerDidChangeContent(controller: NSFetchedResultsController) { 131 | self.tableView.endUpdates() 132 | } 133 | 134 | } 135 | -------------------------------------------------------------------------------- /SwiftNote/SwiftNote.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.ubiquity-container-identifiers 6 | 7 | iCloud.com.appbrewllc.SwiftNote 8 | 9 | com.apple.security.application-groups 10 | 11 | group.swiftnote.appbrewllc.com 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SwiftNote/SwiftNote.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | SwiftNote.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftNote/SwiftNote.xcdatamodeld/SwiftNote.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SwiftNote/SwiftNoteNavigationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftNoteNavigationController.swift 3 | // SwiftNote 4 | // 5 | // Created by AppBrew LLC (appbrewllc.com) on 6/3/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SwiftNoteNavigationController: UINavigationController { 12 | 13 | required init(coder aDecoder: NSCoder) { 14 | super.init(coder: aDecoder) 15 | } 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | // Do any additional setup after loading the view. 21 | } 22 | 23 | override func didReceiveMemoryWarning() { 24 | super.didReceiveMemoryWarning() 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | 29 | /* 30 | // #pragma mark - Navigation 31 | 32 | // In a storyboard-based application, you will often want to do a little preparation before navigation 33 | override func prepareForSegue(segue: UIStoryboardSegue?, sender: AnyObject?) { 34 | // Get the new view controller using [segue destinationViewController]. 35 | // Pass the selected object to the new view controller. 36 | } 37 | */ 38 | 39 | } 40 | -------------------------------------------------------------------------------- /SwiftNoteTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.appbrewllc.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SwiftNoteTests/SwiftNoteTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftNoteTests.swift 3 | // SwiftNoteTests 4 | // 5 | // Created by AppBrew LLC (appbrewllc.com) on 6/3/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class SwiftNoteTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /SwiftNoteTodayWidget/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | SwiftNoteTodayWidget 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | ${PRODUCT_NAME} 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 | -------------------------------------------------------------------------------- /SwiftNoteTodayWidget/MainInterface.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 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 | 76 | 77 | -------------------------------------------------------------------------------- /SwiftNoteTodayWidget/TodayTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodayViewTableViewCell.swift 3 | // SwiftNote 4 | // 5 | // Created by Matthew Lathrop on 6/14/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TodayTableViewCell: UITableViewCell { 12 | 13 | required init(coder aDecoder: NSCoder) { 14 | fatalError("init(coder:) has not been implemented") 15 | } 16 | 17 | @IBOutlet var titleLabel: UILabel! 18 | 19 | @IBOutlet var bodyLabel: UILabel! 20 | 21 | func configure(#note:NoteProtocol!, indexPath:NSIndexPath!) { 22 | self.titleLabel.text = note.title; 23 | self.bodyLabel.text = note.body; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /SwiftNoteTodayWidget/TodayViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodayViewController.swift 3 | // TodayWidget 4 | // 5 | // Created by Matthew Lathrop on 6/3/14. 6 | // Copyright (c) 2014 Matt Lathrop. All rights reserved. 7 | // 8 | 9 | import CoreData 10 | import NotificationCenter 11 | import UIKit 12 | 13 | class TodayViewController: UITableViewController, NCWidgetProviding, NSFetchedResultsControllerDelegate { 14 | 15 | // MARK: variables 16 | let kMaxCellCount = 3 17 | 18 | let kCellHeight = 70.0 19 | 20 | let coreDataProvider = CoreDataProvider() 21 | 22 | var fetchedResultsController: NSFetchedResultsController { 23 | if !(_fetchedResultsController != nil) { 24 | // set up fetch request 25 | var fetchRequest = NSFetchRequest() 26 | fetchRequest.entity = NSEntityDescription.entityForName(kEntityNameNoteEntity, inManagedObjectContext: self.coreDataProvider.managedObjectContext) 27 | 28 | // sort by last updated 29 | var sortDescriptor = NSSortDescriptor(key: "modifiedAt", ascending: false) 30 | fetchRequest.sortDescriptors = [sortDescriptor] 31 | fetchRequest.fetchBatchSize = kMaxCellCount 32 | 33 | _fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.coreDataProvider.managedObjectContext, sectionNameKeyPath: nil, cacheName: nil) 34 | 35 | _fetchedResultsController!.delegate = self 36 | } 37 | 38 | return _fetchedResultsController! 39 | } 40 | var _fetchedResultsController: NSFetchedResultsController? = nil 41 | 42 | // MARK: view handling 43 | 44 | override func viewDidLoad() { 45 | super.viewDidLoad() 46 | 47 | self.fetchedResultsController.performFetch(nil) 48 | } 49 | 50 | func widgetPerformUpdateWithCompletionHandler(completionHandler: ((NCUpdateResult) -> Void)!) { 51 | completionHandler(NCUpdateResult.NewData) 52 | } 53 | 54 | func widgetMarginInsetsForProposedMarginInsets(defaultMarginInsets: UIEdgeInsets) -> UIEdgeInsets { 55 | return UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 0) 56 | } 57 | 58 | // MARK: Table view data source 59 | 60 | override func numberOfSectionsInTableView(tableView: UITableView?) -> Int { 61 | return 1 62 | } 63 | 64 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 65 | let sectionInfo = self.fetchedResultsController.sections?[section] as NSFetchedResultsSectionInfo 66 | 67 | var numRows = sectionInfo.numberOfObjects 68 | if (numRows > kMaxCellCount) { 69 | numRows = kMaxCellCount 70 | } 71 | 72 | // set the content size. subtract one because i don't want the last separator showing 73 | var height = CGFloat(numRows) * CGFloat(kCellHeight) - 1.0 74 | self.preferredContentSize = CGSizeMake(320.0, height) 75 | 76 | return numRows 77 | } 78 | 79 | override func tableView(_: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 80 | let cell = tableView.dequeueReusableCellWithIdentifier(kReuseIdentifierTodayTableViewCell, forIndexPath: indexPath) as TodayTableViewCell 81 | 82 | // set cell defaults 83 | cell.backgroundColor = UIColor.clearColor() 84 | cell.selectionStyle = .None 85 | 86 | // configure the cell 87 | let entity = self.fetchedResultsController.objectAtIndexPath(indexPath) as NSManagedObject 88 | let note = Note.noteFromNoteEntity(entity) 89 | cell.configure(note: note, indexPath: indexPath) 90 | 91 | return cell 92 | } 93 | 94 | override func tableView(tableView: (UITableView!), heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { 95 | return CGFloat(kCellHeight) 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /SwiftNoteTodayWidget/com.appbrewllc.SwiftNote.SwiftNoteTodayWidget.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.swiftnote.appbrewllc.com 8 | 9 | 10 | 11 | --------------------------------------------------------------------------------