Weekly Update 119: The Status of Swift
This is a copy of our weekly newsletter for developers which you can subscribe to here.
We have one more language from our programming mission to get an update for, and it's Swift (including other Apple developer-related searches).
The main sources of data for new Instant Answers so far have been the helpful SwiftDoc.org and Apple's official developer reference. They enable IAs that should greatly help Apple developers, for example:
As usual, we're grateful to have extra help from the contributors in the community, in particular Xinjiang and Sahil. You can join them and help create Apple-related Instant Answers that offer even more lookups, code snippets and tools. Details and current status are in the Swift Overview post on the forum, where Zaahir and Jag are happy to help.
And now, here are some specific issues we're currently looking for help with...
- Identify latest Swift trends
It looks like React Native and Swift 3.0 are popular, but are there others we're missing?
- Add ideas to the Swift Brainstorming discussion
What kinds of IAs would you love to see? What would save you time or make you more productive?
- Create a Fathead that shows tvOS APIs
There's a linked pull request that can be used as a foundation.
- Test new iOS and MacOS Fatheads
These were originally one IA that was split into two. They still need to be tested and likely have room for improvement.
This is more good practice than a tip, but worth a reminder anyway. Whether beginner or expert, it's sensible to name your variables and functions descriptively. This may seem obvious but a lot of code, for example when looking at the source code of web applications, has very short variable names, sometimes just a single letter. This is because the code has been passed through a minifier, making it smaller in size but also harder to read. Don't copy names from this code!
Instead, decide on a naming convention that makes your code readable by humans, whether that's your colleagues, open source contributors, or even you in a few years time. Two rules that have helped me are:
- Start function names with a verb
- Start booleans with "is" or "has"
For instance, examples of easy-to-understand function names include
startTimer. Examples of clear boolean variable names include
hasContent. These are all very readable and make it obvious what the code does.
Like many areas of programming, there are different opinions about naming conventions but this is a good starting point and definitely better than using abbreviations or inconsistent terms.
That's all for now. Enjoy your weekend everyone!
- The DuckDuckGo Staff