├── .gitignore ├── LICENSE ├── LocationNotifier.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── LocationNotifier.xcscheme ├── LocationNotifier ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── LocationNotificationScheduler │ ├── LocationNotificationInfo.swift │ ├── LocationNotificationScheduler.swift │ └── LocationNotificationSchedulerDelegate.swift └── ViewController.swift ├── LocationNotifierTests ├── Info.plist └── LocationNotifierTests.swift ├── LocationNotifierUITests ├── Info.plist └── LocationNotifierUITests.swift ├── README.md └── images └── lock_screen.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 jgsamudio 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 | -------------------------------------------------------------------------------- /LocationNotifier.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 20EE37C822832BE200350735 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20EE37C722832BE200350735 /* AppDelegate.swift */; }; 11 | 20EE37CA22832BE200350735 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20EE37C922832BE200350735 /* ViewController.swift */; }; 12 | 20EE37CD22832BE200350735 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20EE37CB22832BE200350735 /* Main.storyboard */; }; 13 | 20EE37CF22832BE400350735 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 20EE37CE22832BE400350735 /* Assets.xcassets */; }; 14 | 20EE37D222832BE400350735 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20EE37D022832BE400350735 /* LaunchScreen.storyboard */; }; 15 | 20EE37DD22832BE400350735 /* LocationNotifierTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20EE37DC22832BE400350735 /* LocationNotifierTests.swift */; }; 16 | 20EE37E822832BE400350735 /* LocationNotifierUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20EE37E722832BE400350735 /* LocationNotifierUITests.swift */; }; 17 | 20EE37F622834A3F00350735 /* LocationNotificationScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20EE37F522834A3F00350735 /* LocationNotificationScheduler.swift */; }; 18 | 20EE37F9228355B900350735 /* LocationNotificationSchedulerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20EE37F8228355B900350735 /* LocationNotificationSchedulerDelegate.swift */; }; 19 | 20EE37FB228355CE00350735 /* LocationNotificationInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20EE37FA228355CE00350735 /* LocationNotificationInfo.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 20EE37D922832BE400350735 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 20EE37BC22832BE200350735 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 20EE37C322832BE200350735; 28 | remoteInfo = LocationNotifier; 29 | }; 30 | 20EE37E422832BE400350735 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 20EE37BC22832BE200350735 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 20EE37C322832BE200350735; 35 | remoteInfo = LocationNotifier; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 20EE37C422832BE200350735 /* LocationNotifier.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LocationNotifier.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 20EE37C722832BE200350735 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 42 | 20EE37C922832BE200350735 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 43 | 20EE37CC22832BE200350735 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 20EE37CE22832BE400350735 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | 20EE37D122832BE400350735 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 20EE37D322832BE400350735 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | 20EE37D822832BE400350735 /* LocationNotifierTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocationNotifierTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 20EE37DC22832BE400350735 /* LocationNotifierTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationNotifierTests.swift; sourceTree = ""; }; 49 | 20EE37DE22832BE400350735 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 20EE37E322832BE400350735 /* LocationNotifierUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocationNotifierUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 20EE37E722832BE400350735 /* LocationNotifierUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationNotifierUITests.swift; sourceTree = ""; }; 52 | 20EE37E922832BE400350735 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 20EE37F522834A3F00350735 /* LocationNotificationScheduler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationNotificationScheduler.swift; sourceTree = ""; }; 54 | 20EE37F8228355B900350735 /* LocationNotificationSchedulerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationNotificationSchedulerDelegate.swift; sourceTree = ""; }; 55 | 20EE37FA228355CE00350735 /* LocationNotificationInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationNotificationInfo.swift; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 20EE37C122832BE200350735 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | 20EE37D522832BE400350735 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 20EE37E022832BE400350735 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | 20EE37BB22832BE200350735 = { 84 | isa = PBXGroup; 85 | children = ( 86 | 20EE37C622832BE200350735 /* LocationNotifier */, 87 | 20EE37DB22832BE400350735 /* LocationNotifierTests */, 88 | 20EE37E622832BE400350735 /* LocationNotifierUITests */, 89 | 20EE37C522832BE200350735 /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 20EE37C522832BE200350735 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 20EE37C422832BE200350735 /* LocationNotifier.app */, 97 | 20EE37D822832BE400350735 /* LocationNotifierTests.xctest */, 98 | 20EE37E322832BE400350735 /* LocationNotifierUITests.xctest */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | 20EE37C622832BE200350735 /* LocationNotifier */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 20EE37C722832BE200350735 /* AppDelegate.swift */, 107 | 20EE37C922832BE200350735 /* ViewController.swift */, 108 | 20EE37CB22832BE200350735 /* Main.storyboard */, 109 | 20EE37CE22832BE400350735 /* Assets.xcassets */, 110 | 20EE37D022832BE400350735 /* LaunchScreen.storyboard */, 111 | 20EE37D322832BE400350735 /* Info.plist */, 112 | 20EE37F7228355A900350735 /* LocationNotificationScheduler */, 113 | ); 114 | path = LocationNotifier; 115 | sourceTree = ""; 116 | }; 117 | 20EE37DB22832BE400350735 /* LocationNotifierTests */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 20EE37DC22832BE400350735 /* LocationNotifierTests.swift */, 121 | 20EE37DE22832BE400350735 /* Info.plist */, 122 | ); 123 | path = LocationNotifierTests; 124 | sourceTree = ""; 125 | }; 126 | 20EE37E622832BE400350735 /* LocationNotifierUITests */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 20EE37E722832BE400350735 /* LocationNotifierUITests.swift */, 130 | 20EE37E922832BE400350735 /* Info.plist */, 131 | ); 132 | path = LocationNotifierUITests; 133 | sourceTree = ""; 134 | }; 135 | 20EE37F7228355A900350735 /* LocationNotificationScheduler */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 20EE37F522834A3F00350735 /* LocationNotificationScheduler.swift */, 139 | 20EE37F8228355B900350735 /* LocationNotificationSchedulerDelegate.swift */, 140 | 20EE37FA228355CE00350735 /* LocationNotificationInfo.swift */, 141 | ); 142 | path = LocationNotificationScheduler; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXNativeTarget section */ 148 | 20EE37C322832BE200350735 /* LocationNotifier */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 20EE37EC22832BE400350735 /* Build configuration list for PBXNativeTarget "LocationNotifier" */; 151 | buildPhases = ( 152 | 20EE37C022832BE200350735 /* Sources */, 153 | 20EE37C122832BE200350735 /* Frameworks */, 154 | 20EE37C222832BE200350735 /* Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | ); 160 | name = LocationNotifier; 161 | productName = LocationNotifier; 162 | productReference = 20EE37C422832BE200350735 /* LocationNotifier.app */; 163 | productType = "com.apple.product-type.application"; 164 | }; 165 | 20EE37D722832BE400350735 /* LocationNotifierTests */ = { 166 | isa = PBXNativeTarget; 167 | buildConfigurationList = 20EE37EF22832BE400350735 /* Build configuration list for PBXNativeTarget "LocationNotifierTests" */; 168 | buildPhases = ( 169 | 20EE37D422832BE400350735 /* Sources */, 170 | 20EE37D522832BE400350735 /* Frameworks */, 171 | 20EE37D622832BE400350735 /* Resources */, 172 | ); 173 | buildRules = ( 174 | ); 175 | dependencies = ( 176 | 20EE37DA22832BE400350735 /* PBXTargetDependency */, 177 | ); 178 | name = LocationNotifierTests; 179 | productName = LocationNotifierTests; 180 | productReference = 20EE37D822832BE400350735 /* LocationNotifierTests.xctest */; 181 | productType = "com.apple.product-type.bundle.unit-test"; 182 | }; 183 | 20EE37E222832BE400350735 /* LocationNotifierUITests */ = { 184 | isa = PBXNativeTarget; 185 | buildConfigurationList = 20EE37F222832BE400350735 /* Build configuration list for PBXNativeTarget "LocationNotifierUITests" */; 186 | buildPhases = ( 187 | 20EE37DF22832BE400350735 /* Sources */, 188 | 20EE37E022832BE400350735 /* Frameworks */, 189 | 20EE37E122832BE400350735 /* Resources */, 190 | ); 191 | buildRules = ( 192 | ); 193 | dependencies = ( 194 | 20EE37E522832BE400350735 /* PBXTargetDependency */, 195 | ); 196 | name = LocationNotifierUITests; 197 | productName = LocationNotifierUITests; 198 | productReference = 20EE37E322832BE400350735 /* LocationNotifierUITests.xctest */; 199 | productType = "com.apple.product-type.bundle.ui-testing"; 200 | }; 201 | /* End PBXNativeTarget section */ 202 | 203 | /* Begin PBXProject section */ 204 | 20EE37BC22832BE200350735 /* Project object */ = { 205 | isa = PBXProject; 206 | attributes = { 207 | LastSwiftUpdateCheck = 1010; 208 | LastUpgradeCheck = 1010; 209 | ORGANIZATIONNAME = "Jonathan Samudio"; 210 | TargetAttributes = { 211 | 20EE37C322832BE200350735 = { 212 | CreatedOnToolsVersion = 10.1; 213 | }; 214 | 20EE37D722832BE400350735 = { 215 | CreatedOnToolsVersion = 10.1; 216 | TestTargetID = 20EE37C322832BE200350735; 217 | }; 218 | 20EE37E222832BE400350735 = { 219 | CreatedOnToolsVersion = 10.1; 220 | TestTargetID = 20EE37C322832BE200350735; 221 | }; 222 | }; 223 | }; 224 | buildConfigurationList = 20EE37BF22832BE200350735 /* Build configuration list for PBXProject "LocationNotifier" */; 225 | compatibilityVersion = "Xcode 9.3"; 226 | developmentRegion = en; 227 | hasScannedForEncodings = 0; 228 | knownRegions = ( 229 | en, 230 | Base, 231 | ); 232 | mainGroup = 20EE37BB22832BE200350735; 233 | productRefGroup = 20EE37C522832BE200350735 /* Products */; 234 | projectDirPath = ""; 235 | projectRoot = ""; 236 | targets = ( 237 | 20EE37C322832BE200350735 /* LocationNotifier */, 238 | 20EE37D722832BE400350735 /* LocationNotifierTests */, 239 | 20EE37E222832BE400350735 /* LocationNotifierUITests */, 240 | ); 241 | }; 242 | /* End PBXProject section */ 243 | 244 | /* Begin PBXResourcesBuildPhase section */ 245 | 20EE37C222832BE200350735 /* Resources */ = { 246 | isa = PBXResourcesBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | 20EE37D222832BE400350735 /* LaunchScreen.storyboard in Resources */, 250 | 20EE37CF22832BE400350735 /* Assets.xcassets in Resources */, 251 | 20EE37CD22832BE200350735 /* Main.storyboard in Resources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | 20EE37D622832BE400350735 /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | 20EE37E122832BE400350735 /* Resources */ = { 263 | isa = PBXResourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | /* End PBXResourcesBuildPhase section */ 270 | 271 | /* Begin PBXSourcesBuildPhase section */ 272 | 20EE37C022832BE200350735 /* Sources */ = { 273 | isa = PBXSourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | 20EE37FB228355CE00350735 /* LocationNotificationInfo.swift in Sources */, 277 | 20EE37F9228355B900350735 /* LocationNotificationSchedulerDelegate.swift in Sources */, 278 | 20EE37CA22832BE200350735 /* ViewController.swift in Sources */, 279 | 20EE37C822832BE200350735 /* AppDelegate.swift in Sources */, 280 | 20EE37F622834A3F00350735 /* LocationNotificationScheduler.swift in Sources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | 20EE37D422832BE400350735 /* Sources */ = { 285 | isa = PBXSourcesBuildPhase; 286 | buildActionMask = 2147483647; 287 | files = ( 288 | 20EE37DD22832BE400350735 /* LocationNotifierTests.swift in Sources */, 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | }; 292 | 20EE37DF22832BE400350735 /* Sources */ = { 293 | isa = PBXSourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | 20EE37E822832BE400350735 /* LocationNotifierUITests.swift in Sources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | /* End PBXSourcesBuildPhase section */ 301 | 302 | /* Begin PBXTargetDependency section */ 303 | 20EE37DA22832BE400350735 /* PBXTargetDependency */ = { 304 | isa = PBXTargetDependency; 305 | target = 20EE37C322832BE200350735 /* LocationNotifier */; 306 | targetProxy = 20EE37D922832BE400350735 /* PBXContainerItemProxy */; 307 | }; 308 | 20EE37E522832BE400350735 /* PBXTargetDependency */ = { 309 | isa = PBXTargetDependency; 310 | target = 20EE37C322832BE200350735 /* LocationNotifier */; 311 | targetProxy = 20EE37E422832BE400350735 /* PBXContainerItemProxy */; 312 | }; 313 | /* End PBXTargetDependency section */ 314 | 315 | /* Begin PBXVariantGroup section */ 316 | 20EE37CB22832BE200350735 /* Main.storyboard */ = { 317 | isa = PBXVariantGroup; 318 | children = ( 319 | 20EE37CC22832BE200350735 /* Base */, 320 | ); 321 | name = Main.storyboard; 322 | sourceTree = ""; 323 | }; 324 | 20EE37D022832BE400350735 /* LaunchScreen.storyboard */ = { 325 | isa = PBXVariantGroup; 326 | children = ( 327 | 20EE37D122832BE400350735 /* Base */, 328 | ); 329 | name = LaunchScreen.storyboard; 330 | sourceTree = ""; 331 | }; 332 | /* End PBXVariantGroup section */ 333 | 334 | /* Begin XCBuildConfiguration section */ 335 | 20EE37EA22832BE400350735 /* Debug */ = { 336 | isa = XCBuildConfiguration; 337 | buildSettings = { 338 | ALWAYS_SEARCH_USER_PATHS = NO; 339 | CLANG_ANALYZER_NONNULL = YES; 340 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 341 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 342 | CLANG_CXX_LIBRARY = "libc++"; 343 | CLANG_ENABLE_MODULES = YES; 344 | CLANG_ENABLE_OBJC_ARC = YES; 345 | CLANG_ENABLE_OBJC_WEAK = YES; 346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_COMMA = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 351 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 352 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 353 | CLANG_WARN_EMPTY_BODY = YES; 354 | CLANG_WARN_ENUM_CONVERSION = YES; 355 | CLANG_WARN_INFINITE_RECURSION = YES; 356 | CLANG_WARN_INT_CONVERSION = YES; 357 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 358 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 359 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 360 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 361 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 362 | CLANG_WARN_STRICT_PROTOTYPES = YES; 363 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 364 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 365 | CLANG_WARN_UNREACHABLE_CODE = YES; 366 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 367 | CODE_SIGN_IDENTITY = "iPhone Developer"; 368 | COPY_PHASE_STRIP = NO; 369 | DEBUG_INFORMATION_FORMAT = dwarf; 370 | ENABLE_STRICT_OBJC_MSGSEND = YES; 371 | ENABLE_TESTABILITY = YES; 372 | GCC_C_LANGUAGE_STANDARD = gnu11; 373 | GCC_DYNAMIC_NO_PIC = NO; 374 | GCC_NO_COMMON_BLOCKS = YES; 375 | GCC_OPTIMIZATION_LEVEL = 0; 376 | GCC_PREPROCESSOR_DEFINITIONS = ( 377 | "DEBUG=1", 378 | "$(inherited)", 379 | ); 380 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 381 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 382 | GCC_WARN_UNDECLARED_SELECTOR = YES; 383 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 384 | GCC_WARN_UNUSED_FUNCTION = YES; 385 | GCC_WARN_UNUSED_VARIABLE = YES; 386 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 387 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 388 | MTL_FAST_MATH = YES; 389 | ONLY_ACTIVE_ARCH = YES; 390 | SDKROOT = iphoneos; 391 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 392 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 393 | }; 394 | name = Debug; 395 | }; 396 | 20EE37EB22832BE400350735 /* Release */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ALWAYS_SEARCH_USER_PATHS = NO; 400 | CLANG_ANALYZER_NONNULL = YES; 401 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 402 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 403 | CLANG_CXX_LIBRARY = "libc++"; 404 | CLANG_ENABLE_MODULES = YES; 405 | CLANG_ENABLE_OBJC_ARC = YES; 406 | CLANG_ENABLE_OBJC_WEAK = YES; 407 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 408 | CLANG_WARN_BOOL_CONVERSION = YES; 409 | CLANG_WARN_COMMA = YES; 410 | CLANG_WARN_CONSTANT_CONVERSION = YES; 411 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 412 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 413 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 414 | CLANG_WARN_EMPTY_BODY = YES; 415 | CLANG_WARN_ENUM_CONVERSION = YES; 416 | CLANG_WARN_INFINITE_RECURSION = YES; 417 | CLANG_WARN_INT_CONVERSION = YES; 418 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 419 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 420 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 421 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 422 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 423 | CLANG_WARN_STRICT_PROTOTYPES = YES; 424 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 425 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 426 | CLANG_WARN_UNREACHABLE_CODE = YES; 427 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 428 | CODE_SIGN_IDENTITY = "iPhone Developer"; 429 | COPY_PHASE_STRIP = NO; 430 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 431 | ENABLE_NS_ASSERTIONS = NO; 432 | ENABLE_STRICT_OBJC_MSGSEND = YES; 433 | GCC_C_LANGUAGE_STANDARD = gnu11; 434 | GCC_NO_COMMON_BLOCKS = YES; 435 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 436 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 437 | GCC_WARN_UNDECLARED_SELECTOR = YES; 438 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 439 | GCC_WARN_UNUSED_FUNCTION = YES; 440 | GCC_WARN_UNUSED_VARIABLE = YES; 441 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 442 | MTL_ENABLE_DEBUG_INFO = NO; 443 | MTL_FAST_MATH = YES; 444 | SDKROOT = iphoneos; 445 | SWIFT_COMPILATION_MODE = wholemodule; 446 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 447 | VALIDATE_PRODUCT = YES; 448 | }; 449 | name = Release; 450 | }; 451 | 20EE37ED22832BE400350735 /* Debug */ = { 452 | isa = XCBuildConfiguration; 453 | buildSettings = { 454 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 455 | CODE_SIGN_STYLE = Automatic; 456 | DEVELOPMENT_TEAM = FT4NWQ256Y; 457 | INFOPLIST_FILE = LocationNotifier/Info.plist; 458 | LD_RUNPATH_SEARCH_PATHS = ( 459 | "$(inherited)", 460 | "@executable_path/Frameworks", 461 | ); 462 | PRODUCT_BUNDLE_IDENTIFIER = com.LocationNotifier; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | SWIFT_VERSION = 4.2; 465 | TARGETED_DEVICE_FAMILY = "1,2"; 466 | }; 467 | name = Debug; 468 | }; 469 | 20EE37EE22832BE400350735 /* Release */ = { 470 | isa = XCBuildConfiguration; 471 | buildSettings = { 472 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 473 | CODE_SIGN_STYLE = Automatic; 474 | DEVELOPMENT_TEAM = FT4NWQ256Y; 475 | INFOPLIST_FILE = LocationNotifier/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = ( 477 | "$(inherited)", 478 | "@executable_path/Frameworks", 479 | ); 480 | PRODUCT_BUNDLE_IDENTIFIER = com.LocationNotifier; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | SWIFT_VERSION = 4.2; 483 | TARGETED_DEVICE_FAMILY = "1,2"; 484 | }; 485 | name = Release; 486 | }; 487 | 20EE37F022832BE400350735 /* Debug */ = { 488 | isa = XCBuildConfiguration; 489 | buildSettings = { 490 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 491 | BUNDLE_LOADER = "$(TEST_HOST)"; 492 | CODE_SIGN_STYLE = Automatic; 493 | DEVELOPMENT_TEAM = FT4NWQ256Y; 494 | INFOPLIST_FILE = LocationNotifierTests/Info.plist; 495 | LD_RUNPATH_SEARCH_PATHS = ( 496 | "$(inherited)", 497 | "@executable_path/Frameworks", 498 | "@loader_path/Frameworks", 499 | ); 500 | PRODUCT_BUNDLE_IDENTIFIER = com.LocationNotifierTests; 501 | PRODUCT_NAME = "$(TARGET_NAME)"; 502 | SWIFT_VERSION = 4.2; 503 | TARGETED_DEVICE_FAMILY = "1,2"; 504 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LocationNotifier.app/LocationNotifier"; 505 | }; 506 | name = Debug; 507 | }; 508 | 20EE37F122832BE400350735 /* Release */ = { 509 | isa = XCBuildConfiguration; 510 | buildSettings = { 511 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 512 | BUNDLE_LOADER = "$(TEST_HOST)"; 513 | CODE_SIGN_STYLE = Automatic; 514 | DEVELOPMENT_TEAM = FT4NWQ256Y; 515 | INFOPLIST_FILE = LocationNotifierTests/Info.plist; 516 | LD_RUNPATH_SEARCH_PATHS = ( 517 | "$(inherited)", 518 | "@executable_path/Frameworks", 519 | "@loader_path/Frameworks", 520 | ); 521 | PRODUCT_BUNDLE_IDENTIFIER = com.LocationNotifierTests; 522 | PRODUCT_NAME = "$(TARGET_NAME)"; 523 | SWIFT_VERSION = 4.2; 524 | TARGETED_DEVICE_FAMILY = "1,2"; 525 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LocationNotifier.app/LocationNotifier"; 526 | }; 527 | name = Release; 528 | }; 529 | 20EE37F322832BE400350735 /* Debug */ = { 530 | isa = XCBuildConfiguration; 531 | buildSettings = { 532 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 533 | CODE_SIGN_STYLE = Automatic; 534 | DEVELOPMENT_TEAM = FT4NWQ256Y; 535 | INFOPLIST_FILE = LocationNotifierUITests/Info.plist; 536 | LD_RUNPATH_SEARCH_PATHS = ( 537 | "$(inherited)", 538 | "@executable_path/Frameworks", 539 | "@loader_path/Frameworks", 540 | ); 541 | PRODUCT_BUNDLE_IDENTIFIER = com.LocationNotifierUITests; 542 | PRODUCT_NAME = "$(TARGET_NAME)"; 543 | SWIFT_VERSION = 4.2; 544 | TARGETED_DEVICE_FAMILY = "1,2"; 545 | TEST_TARGET_NAME = LocationNotifier; 546 | }; 547 | name = Debug; 548 | }; 549 | 20EE37F422832BE400350735 /* Release */ = { 550 | isa = XCBuildConfiguration; 551 | buildSettings = { 552 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 553 | CODE_SIGN_STYLE = Automatic; 554 | DEVELOPMENT_TEAM = FT4NWQ256Y; 555 | INFOPLIST_FILE = LocationNotifierUITests/Info.plist; 556 | LD_RUNPATH_SEARCH_PATHS = ( 557 | "$(inherited)", 558 | "@executable_path/Frameworks", 559 | "@loader_path/Frameworks", 560 | ); 561 | PRODUCT_BUNDLE_IDENTIFIER = com.LocationNotifierUITests; 562 | PRODUCT_NAME = "$(TARGET_NAME)"; 563 | SWIFT_VERSION = 4.2; 564 | TARGETED_DEVICE_FAMILY = "1,2"; 565 | TEST_TARGET_NAME = LocationNotifier; 566 | }; 567 | name = Release; 568 | }; 569 | /* End XCBuildConfiguration section */ 570 | 571 | /* Begin XCConfigurationList section */ 572 | 20EE37BF22832BE200350735 /* Build configuration list for PBXProject "LocationNotifier" */ = { 573 | isa = XCConfigurationList; 574 | buildConfigurations = ( 575 | 20EE37EA22832BE400350735 /* Debug */, 576 | 20EE37EB22832BE400350735 /* Release */, 577 | ); 578 | defaultConfigurationIsVisible = 0; 579 | defaultConfigurationName = Release; 580 | }; 581 | 20EE37EC22832BE400350735 /* Build configuration list for PBXNativeTarget "LocationNotifier" */ = { 582 | isa = XCConfigurationList; 583 | buildConfigurations = ( 584 | 20EE37ED22832BE400350735 /* Debug */, 585 | 20EE37EE22832BE400350735 /* Release */, 586 | ); 587 | defaultConfigurationIsVisible = 0; 588 | defaultConfigurationName = Release; 589 | }; 590 | 20EE37EF22832BE400350735 /* Build configuration list for PBXNativeTarget "LocationNotifierTests" */ = { 591 | isa = XCConfigurationList; 592 | buildConfigurations = ( 593 | 20EE37F022832BE400350735 /* Debug */, 594 | 20EE37F122832BE400350735 /* Release */, 595 | ); 596 | defaultConfigurationIsVisible = 0; 597 | defaultConfigurationName = Release; 598 | }; 599 | 20EE37F222832BE400350735 /* Build configuration list for PBXNativeTarget "LocationNotifierUITests" */ = { 600 | isa = XCConfigurationList; 601 | buildConfigurations = ( 602 | 20EE37F322832BE400350735 /* Debug */, 603 | 20EE37F422832BE400350735 /* Release */, 604 | ); 605 | defaultConfigurationIsVisible = 0; 606 | defaultConfigurationName = Release; 607 | }; 608 | /* End XCConfigurationList section */ 609 | }; 610 | rootObject = 20EE37BC22832BE200350735 /* Project object */; 611 | } 612 | -------------------------------------------------------------------------------- /LocationNotifier.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LocationNotifier.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LocationNotifier.xcodeproj/xcshareddata/xcschemes/LocationNotifier.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /LocationNotifier/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // LocationNotifier 4 | // 5 | // Created by Jonathan Samudio on 5/8/19. 6 | // Copyright © 2019 Jonathan Samudio. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /LocationNotifier/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /LocationNotifier/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /LocationNotifier/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 | -------------------------------------------------------------------------------- /LocationNotifier/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 | 28 | 29 | 30 | 31 | 32 | 33 | 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 | -------------------------------------------------------------------------------- /LocationNotifier/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | NSLocationWhenInUseUsageDescription 45 | Location needed to display an example 46 | 47 | 48 | -------------------------------------------------------------------------------- /LocationNotifier/LocationNotificationScheduler/LocationNotificationInfo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LocationNotificationInfo.swift 3 | // LocationNotifier 4 | // 5 | // Created by Jonathan Samudio on 5/8/19. 6 | // Copyright © 2019 Jonathan Samudio. All rights reserved. 7 | // 8 | 9 | import CoreLocation 10 | 11 | struct LocationNotificationInfo { 12 | 13 | // Identifiers 14 | let notificationId: String 15 | let locationId: String 16 | 17 | // Location 18 | let radius: Double 19 | let latitude: Double 20 | let longitude: Double 21 | 22 | // Notification 23 | let title: String 24 | let body: String 25 | let data: [String: Any]? 26 | 27 | /// CLLocation Coordinates 28 | var coordinates: CLLocationCoordinate2D { 29 | return CLLocationCoordinate2D(latitude: latitude, 30 | longitude: longitude) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LocationNotifier/LocationNotificationScheduler/LocationNotificationScheduler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LocationNotificationScheduler.swift 3 | // LocationNotifier 4 | // 5 | // Created by Jonathan Samudio on 5/8/19. 6 | // Copyright © 2019 Jonathan Samudio. All rights reserved. 7 | // 8 | 9 | import CoreLocation 10 | import UserNotifications 11 | 12 | class LocationNotificationScheduler: NSObject { 13 | 14 | // MARK: - Public Properties 15 | 16 | weak var delegate: LocationNotificationSchedulerDelegate? { 17 | didSet { 18 | UNUserNotificationCenter.current().delegate = delegate 19 | } 20 | } 21 | 22 | // MARK: - Private Properties 23 | 24 | private let locationManager = CLLocationManager() 25 | 26 | // MARK: - Public Functions 27 | 28 | /// Request a geo location notification with optional data. 29 | /// 30 | /// - Parameter data: Data that will be sent with the notification. 31 | func requestNotification(with notificationInfo: LocationNotificationInfo) { 32 | switch CLLocationManager.authorizationStatus() { 33 | case .notDetermined: 34 | locationManager.requestWhenInUseAuthorization() 35 | askForNotificationPermissions(notificationInfo: notificationInfo) 36 | case .authorizedWhenInUse, .authorizedAlways: 37 | askForNotificationPermissions(notificationInfo: notificationInfo) 38 | case .restricted, .denied: 39 | delegate?.locationPermissionDenied() 40 | break 41 | } 42 | } 43 | } 44 | 45 | // MARK: - Private Functions 46 | 47 | private extension LocationNotificationScheduler { 48 | 49 | func askForNotificationPermissions(notificationInfo: LocationNotificationInfo) { 50 | guard CLLocationManager.locationServicesEnabled() else { 51 | return 52 | } 53 | UNUserNotificationCenter.current().requestAuthorization( 54 | options: [.alert, .sound, .badge], 55 | completionHandler: { [weak self] granted, _ in 56 | guard granted else { 57 | DispatchQueue.main.async { 58 | self?.delegate?.notificationPermissionDenied() 59 | } 60 | return 61 | } 62 | self?.requestNotification(notificationInfo: notificationInfo) 63 | }) 64 | } 65 | 66 | func requestNotification(notificationInfo: LocationNotificationInfo) { 67 | let notification = notificationContent(notificationInfo: notificationInfo) 68 | let destRegion = destinationRegion(notificationInfo: notificationInfo) 69 | let trigger = UNLocationNotificationTrigger(region: destRegion, repeats: false) 70 | 71 | let request = UNNotificationRequest(identifier: notificationInfo.notificationId, 72 | content: notification, 73 | trigger: trigger) 74 | 75 | UNUserNotificationCenter.current().add(request) { [weak self] (error) in 76 | DispatchQueue.main.async { 77 | self?.delegate?.notificationScheduled(error: error) 78 | } 79 | } 80 | } 81 | 82 | func notificationContent(notificationInfo: LocationNotificationInfo) -> UNMutableNotificationContent { 83 | let notification = UNMutableNotificationContent() 84 | notification.title = notificationInfo.title 85 | notification.body = notificationInfo.body 86 | notification.sound = UNNotificationSound.default 87 | 88 | if let data = notificationInfo.data { 89 | notification.userInfo = data 90 | } 91 | return notification 92 | } 93 | 94 | func destinationRegion(notificationInfo: LocationNotificationInfo) -> CLCircularRegion { 95 | let destRegion = CLCircularRegion(center: notificationInfo.coordinates, 96 | radius: notificationInfo.radius, 97 | identifier: notificationInfo.locationId) 98 | destRegion.notifyOnEntry = true 99 | destRegion.notifyOnExit = false 100 | return destRegion 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /LocationNotifier/LocationNotificationScheduler/LocationNotificationSchedulerDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LocationNotificationSchedulerDelegate.swift 3 | // LocationNotifier 4 | // 5 | // Created by Jonathan Samudio on 5/8/19. 6 | // Copyright © 2019 Jonathan Samudio. All rights reserved. 7 | // 8 | 9 | import UserNotifications 10 | 11 | protocol LocationNotificationSchedulerDelegate: UNUserNotificationCenterDelegate { 12 | 13 | /// Called when the user has denied the notification permission prompt. 14 | func notificationPermissionDenied() 15 | 16 | /// Called when the user has denied the location permission prompt. 17 | func locationPermissionDenied() 18 | 19 | /// Called when the notification request completed. 20 | /// 21 | /// - Parameter error: Optional error when trying to add the notification. 22 | func notificationScheduled(error: Error?) 23 | } 24 | -------------------------------------------------------------------------------- /LocationNotifier/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // LocationNotifier 4 | // 5 | // Created by Jonathan Samudio on 5/8/19. 6 | // Copyright © 2019 Jonathan Samudio. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import UserNotifications 11 | 12 | class ViewController: UIViewController { 13 | 14 | private let locationNotificationScheduler = LocationNotificationScheduler() 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | locationNotificationScheduler.delegate = self 19 | } 20 | 21 | /// Center button to schedule a notification. 22 | /// 23 | /// - Parameter sender: Button sender. 24 | @IBAction func scheduleLocationNotification(_ sender: Any) { 25 | let notificationInfo = LocationNotificationInfo(notificationId: "nyc_promenade_notification_id", 26 | locationId: "nyc_promenade_location_id", 27 | radius: 500.0, 28 | latitude: 40.696503, 29 | longitude: -73.997809, 30 | title: "Welcome to the Brooklyn Promenade!", 31 | body: "Tap to see more information", 32 | data: ["location": "NYC Brooklyn Promenade"]) 33 | 34 | locationNotificationScheduler.requestNotification(with: notificationInfo) 35 | } 36 | } 37 | 38 | extension ViewController: LocationNotificationSchedulerDelegate { 39 | 40 | func locationPermissionDenied() { 41 | let message = "The location permission was not authorized. Please enable it in Settings to continue." 42 | presentSettingsAlert(message: message) 43 | } 44 | 45 | func notificationPermissionDenied() { 46 | let message = "The notification permission was not authorized. Please enable it in Settings to continue." 47 | presentSettingsAlert(message: message) 48 | } 49 | 50 | func notificationScheduled(error: Error?) { 51 | if let error = error { 52 | let alertController = UIAlertController(title: "Notification Schedule Error", 53 | message: error.localizedDescription, 54 | preferredStyle: .alert) 55 | alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) 56 | present(alertController, animated: true) 57 | } else { 58 | let alertController = UIAlertController(title: "Notification Scheduled!", 59 | message: "You will be notified when you are near the location!", 60 | preferredStyle: .alert) 61 | alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) 62 | present(alertController, animated: true) 63 | } 64 | } 65 | 66 | func userNotificationCenter(_ center: UNUserNotificationCenter, 67 | didReceive response: UNNotificationResponse, 68 | withCompletionHandler completionHandler: @escaping () -> Void) { 69 | if response.notification.request.identifier == "nyc_promenade_notification_id" { 70 | let notificationData = response.notification.request.content.userInfo 71 | let message = "You have reached \(notificationData["location"] ?? "your location!")" 72 | 73 | let alertController = UIAlertController(title: "Welcome!", 74 | message: message, 75 | preferredStyle: .alert) 76 | alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) 77 | present(alertController, animated: true) 78 | } 79 | completionHandler() 80 | } 81 | 82 | private func presentSettingsAlert(message: String) { 83 | let alertController = UIAlertController(title: "Permissions Denied!", 84 | message: message, 85 | preferredStyle: .alert) 86 | 87 | let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil) 88 | let settingsAction = UIAlertAction(title: "Settings", style: .default) { (alertAction) in 89 | if let appSettings = URL(string: UIApplication.openSettingsURLString) { 90 | UIApplication.shared.open(appSettings) 91 | } 92 | } 93 | 94 | alertController.addAction(cancelAction) 95 | alertController.addAction(settingsAction) 96 | 97 | present(alertController, animated: true) 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /LocationNotifierTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LocationNotifierTests/LocationNotifierTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LocationNotifierTests.swift 3 | // LocationNotifierTests 4 | // 5 | // Created by Jonathan Samudio on 5/8/19. 6 | // Copyright © 2019 Jonathan Samudio. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import LocationNotifier 11 | 12 | class LocationNotifierTests: XCTestCase { 13 | 14 | override func 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 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /LocationNotifierUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LocationNotifierUITests/LocationNotifierUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LocationNotifierUITests.swift 3 | // LocationNotifierUITests 4 | // 5 | // Created by Jonathan Samudio on 5/8/19. 6 | // Copyright © 2019 Jonathan Samudio. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class LocationNotifierUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 20 | XCUIApplication().launch() 21 | 22 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 23 | } 24 | 25 | override func tearDown() { 26 | // Put teardown code here. This method is called after the invocation of each test method in the class. 27 | } 28 | 29 | func testExample() { 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LocationNotifier 2 | Location Triggered Notification App using UNLocationNotificationTrigger 3 | 4 | Example Project for the Blog: [Location Triggered Notifications on iOS](https://medium.com/@jonathan2457/location-triggered-notifications-on-ios-24033919fb9a) 5 | 6 | Tapping the _"Schedule Location Notification"_ button will schedule a notification to go off when the device is ~500 meters away from the Brooklyn Promenade 7 | 8 | ![lock_screen.png](images/lock_screen.png) 9 | 10 | ## Usage 11 | 12 | ``` 13 | let locationNotificationScheduler = LocationNotificationScheduler() 14 | 15 | let notificationInfo = LocationNotificationInfo(notificationId: "nyc_promenade_notification_id", 16 | locationId: "nyc_promenade_location_id", 17 | radius: 500.0, 18 | latitude: 40.696503, 19 | longitude: -73.997809, 20 | title: "Welcome to the Brooklyn Promenade!", 21 | body: "Tap to see more information", 22 | data: ["location": "NYC Brooklyn Promenade"]) 23 | 24 | locationNotificationScheduler.requestNotification(with: notificationInfo) 25 | ``` 26 | 27 | The `LocationNotificationScheduler` needs a `LocationNotificationInfo` object to request a notification. 28 | 29 | ### LocationNotificationInfo Properties 30 | 31 | - `notificationId` - Unique Id used to identify this specific type of notification 32 | - `locationId` - Unique Id used to identify this specific location 33 | - `radius` - Double radius from the center in meters 34 | - `latitude` - Center latitude of the location 35 | - `longitude` - Center longitude of the location 36 | - `title` - Title of the notification 37 | - `body` - Body message of the notification 38 | - `data` - Optional data that will be sent with the notification 39 | 40 | ### LocationNotificationSchedulerDelegate 41 | 42 | The `LocationNotificationSchedulerDelegate` will provide functions to interact with the `LocationNotificationScheduler`. 43 | 44 | ### Set the delegate 45 | 46 | `locationNotificationScheduler.delegate = self` 47 | 48 | ### Available Functions 49 | 50 | ``` 51 | /// Called when the user has denied the notification permission prompt. 52 | func notificationPermissionDenied() 53 | 54 | /// Called when the user has denied the location permission prompt. 55 | func locationPermissionDenied() 56 | 57 | /// Called when the notification request completed. 58 | /// 59 | /// - Parameter error: Optional error when trying to add the notification. 60 | func notificationScheduled(error: Error?) 61 | ``` 62 | 63 | ### UNUserNotificationCenterDelegate 64 | 65 | The `LocationNotificationSchedulerDelegate` also extends the `UNUserNotificationCenterDelegate` which provides extra functions that interact with the notification. 66 | 67 | The `didReceive` function below is used to handle when a user selects the notification. This function will be called when the app is in the foreground or background. 68 | 69 | ``` 70 | func userNotificationCenter(_ center: UNUserNotificationCenter, 71 | didReceive response: UNNotificationResponse, 72 | withCompletionHandler completionHandler: @escaping () -> Void) { 73 | 74 | if response.notification.request.identifier == "nyc_promenade_notification_id" { 75 | let notificationData = response.notification.request.content.userInfo 76 | 77 | // Do something with this notification data. 78 | // This is the same as the data in the LocationNotificationInfo 79 | } 80 | 81 | completionHandler() 82 | } 83 | ``` 84 | 85 | ## References 86 | 87 | - [UNLocationNotificationTrigger](https://developer.apple.com/documentation/usernotifications/unlocationnotificationtrigger) 88 | 89 | -------------------------------------------------------------------------------- /images/lock_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jgsamudio/LocationNotifier/3f38b5eff18777867d84fa7a27a94b7c34229a26/images/lock_screen.png --------------------------------------------------------------------------------