iOS Development

Storage

  • Bundle: built into the application
  • Application Sandbox: directory limited in access to your application
    • Documents: backed up - FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
    • Library
      • Caches: not backed up
      • Preferences: backed up
    • tmp: not backed up, should clear out when done

Scene States

  • Unattached: does not execute code, does not have any memory reserved
  • Foreground Active: interface on screen, accepting events, code handling them
  • Foreground Inactive: interrupted by a system event, like a phone call, Siri or task switcher. Visible and executing code, but not receiving events
  • Background State: home screen or another app. Save data and release shared resources as quickly as possible
  • Suspended State: after a default of 10 seconds of being in background state. Can’t see interface, can’t execute code. Like a snapshot. Stays as long as there is system memory (may still show in the task switcher, but will be relaunched)
State Visible Receives Events Executes Code
Unattached no no no
Foreground Active yes yes yes
Foreground Inactive mostly no yes
Background no no yes
Suspended no no no