Skip to content
This repository was archived by the owner on Sep 4, 2018. It is now read-only.

Conversation

@koke
Copy link
Member

@koke koke commented Nov 10, 2015

Since WPAnalyticsStat is the name of the enum, Swift will remove that
as a prefix so you can do things like .LoginFailed.

In #36, a number of 3D Touch related constants were introduced, which
would be mapped as .3DTouchShortcut* enum values. As I understand it,
Swift names can't start with a digit, which is probably why the compiler
was only stripping the WPAnalytics prefix but leaving the Stats, and
all the enum references in Swift were broken.

analytics-swift-enums

I know it's not really called Force Touch on the iPhone, so feel free to
use an alternative, as long as it doesn't start with a digit.

Linking to the frameworks issue for reference: wordpress-mobile/WordPress-iOS#4434

Needs Review: @kwonye

Since `WPAnalyticsStat` is the name of the enum, Swift will remove that
as a prefix so you can do things like `.LoginFailed`.

In #36, a number of 3D Touch related constants were introduced, which
would be mapped as `.3DTouchShortcut*` enum values. As I understand it,
Swift names can't start with a digit, which is probably why the compiler
was only stripping the `WPAnalytics` prefix but leaving the `Stats`, and
all the enum references in Swift were broken.

I know it's not really called Force Touch on the iPhone, so feel free to
use an alternative, as long as it doesn't start with a digit.
@astralbodies
Copy link
Contributor

ThreeD 😄

@koke koke mentioned this pull request Nov 10, 2015
@koke
Copy link
Member Author

koke commented Nov 10, 2015

I considered ThreeD, ThreeDee, TD, or just leave it at Shortcut. ¯\_(ツ)_/¯

@kwonye
Copy link
Contributor

kwonye commented Nov 10, 2015

ThreeD
or just leave it at Shortcut

^ Can we change to one of those please? Either one works for me 😊

@kwonye kwonye self-assigned this Nov 10, 2015
@koke
Copy link
Member Author

koke commented Nov 10, 2015

Shortcut it is then :)

@kwonye
Copy link
Contributor

kwonye commented Nov 10, 2015

👍 :shipit: 💯 🎱

koke added a commit that referenced this pull request Nov 11, 2015
Avoid numbers in enums for Swift compatibility
@koke koke merged commit b4b092a into develop Nov 11, 2015
@koke koke deleted the fix/3dtouch-swift-enums branch November 11, 2015 07:57
koke added a commit to wordpress-mobile/WordPress-iOS that referenced this pull request Nov 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants