{"id":13489131,"url":"https://github.com/shagedorn/StateRestorationDemo","last_synced_at":"2025-03-28T04:30:54.815Z","repository":{"id":18349990,"uuid":"21529843","full_name":"shagedorn/StateRestorationDemo","owner":"shagedorn","description":"App to demonstrate state preservation and restoration APIs","archived":false,"fork":false,"pushed_at":"2023-10-03T09:04:29.000Z","size":10115,"stargazers_count":49,"open_issues_count":0,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-31T02:33:31.123Z","etag":null,"topics":["ios","restoration-apis","sample-app","state-restoration","swift","uikit"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shagedorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-07-05T23:15:35.000Z","updated_at":"2024-08-09T03:49:11.000Z","dependencies_parsed_at":"2023-10-03T16:46:57.925Z","dependency_job_id":null,"html_url":"https://github.com/shagedorn/StateRestorationDemo","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shagedorn%2FStateRestorationDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shagedorn%2FStateRestorationDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shagedorn%2FStateRestorationDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shagedorn%2FStateRestorationDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shagedorn","download_url":"https://codeload.github.com/shagedorn/StateRestorationDemo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245970338,"owners_count":20702390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","restoration-apis","sample-app","state-restoration","swift","uikit"],"created_at":"2024-07-31T19:00:17.681Z","updated_at":"2025-03-28T04:30:54.192Z","avatar_url":"https://github.com/shagedorn.png","language":"Swift","readme":"# StateRestorationDemo\n\n#### Swift app to demonstrate state preservation and restoration APIs.\n\n![](https://raw.githubusercontent.com/shagedorn/StateRestorationDemo/master/Presentation/app_screenshot.png)\n\nCreated for a presentation at CocoaHeads Dresden on 09 July 2014. The Deckset \npresentation (rendered as PDF and the Markdown source) is included in the \nrepository. Feel free to open a GitHub Issue for questions regarding this project.\n\nLast verified with Xcode 14.3 and iOS 16.2. The app is written in Swift 5.7.\n\n⚠️ This app demonstrates view- and view-controller-based state restoration in\nUIKit. As of iOS 13, Apple encourages to adopt user-activity-based state \nrestoration. \n\nPlease consult the [official documentation](https://developer.apple.com/documentation/uikit/uiviewcontroller/restoring_your_app_s_state) \nfor a comparison of the two approaches and official demo material.\n\n## Tags \n\nTags outline the various steps to enable state restoration in iOS apps:\n\n+ `NO_STATE_RESTORATION`: The app without state restoration\n+ `STATE_RESTORATION_OPT_IN`: The app generally enables state restoration, but does not implement it yet\n+ `RESTORATION_IDENTIFIERS`: The app sets restoration identifiers on view controllers, but the controllers are not restored successfully yet\n+ `BASIC_STATE_RESTORATION`: Initially created view controllers are restored successfully\n+ `RESTORATION_CLASS`: Non-initial view controllers are restored, too\n+ `STATE_ENCODING`: View controllers restore their views' state\n+ `SIZE_CLASSES`: The window's size classes are preserved\n\n**Note:** Both to improve the project and to support the current version of \nSwift, there have been major updates that are not reflected by the tagged \ncommits. The tags are still helpful to follow the various steps, but you \nshould use the latest commit on `main` for a working version.\n\n## Limitations\n\nBy default, state restoration happens synchronously at launch on the main queue.\nWhile you can [move work off the main queue](https://developer.apple.com/documentation/uikit/uiapplication/1623060-extendstaterestoration),\nit will still kick in right after app launch and should finish as quickly as\npossible, which means it cannot easily be adopted by apps that need to log in \nor fetch a new session on every launch.\n\n## Other Resources\n\n[Apple Sample Code: State Restoration of Child View Controllers](https://developer.apple.com/library/content/samplecode/StateRestoreChildViews/)\n","funding_links":[],"categories":["Sample","Demo Apps / 示例程序","Demo Apps"],"sub_categories":["RSS","iOS"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshagedorn%2FStateRestorationDemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshagedorn%2FStateRestorationDemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshagedorn%2FStateRestorationDemo/lists"}