Skip to content

mrPronin/ios-geofencing-demo

Repository files navigation

iOS geofencing demo

Description

  • language: Swift
  • architecture: MVVM + Combine
  • UI: SwiftUI
  • location updates in the background, geofencing
  • localization & internalization (currently suppotts 'en' and 'de'), example Network+Errors.swift
  • zero external dependencies
  • property wrappers dependency injection for services

User stories

  • User story 1. As a user of the application, I want to be able to start a journey by clicking the "Start" button, and then end the journey by clicking the "Stop" button. It should be one button, but the title should change depending on the mode.
  • User story 2. As a user of the application, I have to receive a permission request to use location.
  • User story 3. As a user of the app, every time I open the app, I have to see a list of pictures from Flickr that are tied to the user's location during the journey every 100 meters. New pictures should be at the top. Whenever the user takes a look at their phone, they see the most recent picture and can scroll through a stream of pictures that shows where the user has been.
  • User story 4. As a user of the app, I should be able to use the travel mode for at least a two-hour walk.

ENVIRONMENT

For the project to work correctly, you need to set the environment variable FLICKR_API_KEY. Edit scheme to setup environment variable

TODO

  • define git repository and initial README, .gitignore etc.
  • make initial project setup with SwiftUI interface and UIKit AppDelegate
  • add scene delegate
  • create basic UI start / stop button with SwiftUI
  • refactor to MVVM (perhaps temporarily)
  • add location usage description and enable location updates in the background on Signing & Capabilities
  • add feature to fetch user starting location at the beginning of the journey
  • define codable model to keep coordinate and identifier, add helper method to create CLCircularRegion from model
  • integrate network service, implement mocket localization service
  • implement DI with property wrappers, implement localization service and inject it to network service
  • localize app with localization service, error handling in particular
  • implement FlickrService to fetch image url from Flickr by location (latitude, longitude)
    • define models - Image and PagedPhotosResponse
    • define flickr photos search endpoint
    • define flickr service protocol
    • implement flickr service and inject it into JourneyViewModel
    • fix issues with base url and flickr response
  • add service to persist ordered location list, implement addLocation, getLocations and removeLocations methods
    • define journey storage service protocol
    • implement journey storage service with user defaults
    • implement dependency injection for journey storage service
    • inject journey storage service into JourneyViewModel
  • get initial location and store it to the list
  • show alert if geofencing is not supported on current device
  • define initial monitoring region for user starting location and start monotoring when user exit region
  • create 'stopMonitoring' method to remove monitoring region
  • implement alert if authorizationStatus != authorizedAlways
  • refactor: extract locationManager to separate service - LocationService, handle location errors
  • handle location event 'didExitRegion', remove current monitoring region, get current location and save it to the list, define new monitoring region
  • add simulated locations, test feature, fix bugs
  • implement location log service
  • debug didExitRegion on device, small improvements
  • create mocked JourneyStorage and feed it with mocked journey json
  • fetch images for location list
  • clean-up debug and log
  • create UI for images list
  • create journey view model protocol
  • unit-tests
    • implement unit-tests for journey view model
      • create mocked Flickr response and Fllickr mocked service
      • create mocked location service
      • unit-test journey view model: testInitialState
      • unit-test journey view model: testStartStopLocationTracking_Start, testStartStopLocationTracking_Stop
      • unit-test journey view model: testLoadImages and testLoadImagesWithError
    • unit-test endpoint for network
    • unit-test flickr service (?)
    • unit-test location service, mock CLLocationManager in LocationService
  • feat: use environment variables for sensitive data instead of git
  • fix: improve (?) the accuracy and relevance of images based on geo-location
  • fix: remove images duplication
  • feat: implement background fetch for images
  • add SwiftLint
  • (optional) implement full app localization
  • refactor to TCA

About

SwiftUI geofencing iOS app demo with MVVM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages