# tvOS Save Game State?

**URL:** <https://ifnotnil.com/t/tvos-save-game-state/3788>\
**Category:** Other\
**Created:** [21 January 2024 16:47 UTC](https://ifnotnil.com/t/tvos-save-game-state/3788 "2024-01-21T16:47:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaveS](https://ifnotnil.com/user_avatar/ifnotnil.com/daves/32/79_2.png) [@DaveS](https://ifnotnil.com/u/DaveS)\
**Post date:** [21 January 2024 16:47 UTC](https://ifnotnil.com/t/tvos-save-game-state/3788/1 "2024-01-21T16:47:34Z")

</div>

I have a game app, it has 300 levels, and I need to store (for each level) 2 states

1. has this level been attempted?
2. if it has been attempted, was it completed

tvOS under Swift (without using iCloud) is limited in what/where it is allowed to permentaly store things.  
So I am basicly limited to `UserDefaults`

The only idea I have had so far is to create a 300 character string with each character position being a letter that indicates the current state

Anyone have a better one?

---

<div class="post-metadata">

**Author:** ![DaveS](https://ifnotnil.com/user_avatar/ifnotnil.com/daves/32/79_2.png) [@DaveS](https://ifnotnil.com/u/DaveS)\
**Post date:** [21 January 2024 16:58 UTC](https://ifnotnil.com/t/tvos-save-game-state/3788/2 "2024-01-21T16:58:01Z")

</div>

I can do it with only two Integer values

1. the highest level available. A level cannot be attempted until all levels below are completed
2. the highest level complete. This would usually be “available” - 1
