Azoy / Sword

Discord library for Swift
https://azoy.github.io/Sword
MIT License
179 stars 52 forks source link

Typealias Snowflake to a bunch of ID types to make autocomplete better #25

Closed TellowKrinkle closed 7 years ago

TellowKrinkle commented 7 years ago

Previously, Xcode's autocomplete would give you the suggestions like addReaction(reaction: String, to: Snowflake, in: Snowflake), which tell you nothing about what variable goes in the to and what goes in the in. Now the suggestions look like addReaction(reaction: String, to: MessageID, in: ChannelID) which makes it obvious that the to should be a message ID and the in should be a channel ID. Because they are just typealiases, this will not break any existing code that still refers to the variables with the type Snowflake.

Before, in the autocomplete menu:

Image of the autocomplete menu before this commit

Before, after selecting an autocompletion:

Image of an autocompletion before this commit

Now, in the autocomplete menu:

Image of the autocomplete menu after this commit

Now, after selecting an autocompletion:

Image of an autocompletion after this commit