-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Reminder: Apple Watches use 32 bit pointers | ||
|
||
> Since the Series 4 was introduced in 2018, all new Apple Watches have been arm64_32. The last | ||
> Apple Watch to be armv7k was the Series 3. | ||
Source: https://forums.developer.apple.com/forums/thread/759363 | ||
|
||
What is arm64_32? It's a 64 bit operating system that runs on 32 bit pointers. | ||
|
||
When you test on the watchOS simulator, you're typically going to be testing with 64-bit pointers, | ||
so you'll get a 64 bit Int when testing in sim and a 32 bit Int when testing on hardware. | ||
|
||
Something as simple as | ||
|
||
```swift | ||
print(String(Int(Date.now.timeIntervalSince1970 * 1000))) | ||
``` | ||
|
||
can work fine in the simulator but causes a runtime crash on hardware. Be mindful of your use of Int | ||
and CGFloat types when deploying code to the Apple Watch. | ||
|
||
Here's the output of Int.max on each platform: | ||
|
||
| Simulator | Hardware (oh no!) | | ||
|:---------:|:-------------------:| | ||
| ![64 bit pointers on Apple Watch simulator](/gfx/pointers/64bit.png) | ![32 bit pointers on Apple Watch hardware](/gfx/pointers/32bit.png) | | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.