RESOURCES

You’ve come a long way in developing your iOS coding skills, which means you now have what it takes to make your own apps from scratch. The best way to get better at making apps is by making more apps. Think about an app that you’d love to make, and then make it! Choosing something that excites you will make it easy to stay motivated. With every app you work on, there will be something new you haven’t had to do before, and thus a new learning opportunity. Once you’ve explored some app ideas and have written a lot of code, you’ll have a better idea of what areas to focus on.

This appendix provides some resources that will help you as you make your own apps, including tips for troubleshooting errors, where to find useful documentation, handy keyboard shortcuts, and information about Xcode versions.

TROUBLESHOOTING ERRORS

We can’t cover every possible thing that can go wrong. But if you’re having trouble building or running your apps, there are a few steps you can take to figure out what’s going on. Here are some tips for finding solutions to any problems you encounter:

• Check the error message that Xcode is giving you. If you switch to the Issue navigator (-4), you can view the current list of errors and warnings. Warnings are in yellow and usually don’t have to be fixed (though it is strongly suggested you do fix them because they often turn into errors later). Errors are in red, and they must be fixed before the project will build. Sometimes the error message will tell you how to fix the issue, so make sure to read it and to also try to understand what’s causing the issue.

• If the cause of the issue isn’t clear, it’s often helpful to tell Xcode to clean things up and try again. When you build a project in Xcode, it creates temporary files that are used to make future builds faster. Sometimes these files need to be removed so that the build process can create them again from scratch. There are two ways to “clean” in Xcode. You can clean the project with -SHIFT-K, or you can clean the build folder with -OPTION-SHIFT-K. Both methods do the same thing, but cleaning the build folder is more thorough. Try one or both of these, and then build the project again and see if the error goes away.

• Search the web for the issue you’re having. It’s a good idea to search for the exact error message that Xcode is giving you so you can find other people who have encountered the same issue and see how they solved it. These web searches will often take you to a website called Stack Overflow (http://www.stackoverflow.com/), which is dedicated to programming questions, errors, and solutions.

• Try closing and reopening Xcode, and if that doesn’t help, reboot your computer.

• Read the docs! The next section tells you where to find any documentation you may need.

APPLE DOCUMENTATION

Apple has easily accessible documentation for everything you could hope to know about iOS, Swift, and more. To access it, log in to your Apple Developer Center account and visit these links:

The API Reference (https://developer.apple.com/reference/) contains the full documentation of the iOS SDK. Here, you’ll be able to research any method, property, or class within the iOS SDK and learn how it is used. To access this documentation from within Xcode, select Window Documentation and API Reference from the menu, or use the keyboard shortcut -SHIFT-0.

Guides and Sample Code (https://developer.apple.com/library/content/navigation/) features hundreds of how-tos and examples, all written by Apple developers, covering every iOS topic under the sun.

The Apple Developer Forum (https://forums.developer.apple.com/) is a great place to find answers to many questions.

The iOS Human Interface Guidelines (https://developer.apple.com/ios/human-interface-guidelines/overview/design-principles/) is where Apple explains exactly what makes a great app and offers guidance on how to approach designing apps.

The App Distribution Guide (https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/Introduction/Introduction.html) is Apple’s guide to distributing apps on the App Store.

NOTE

The links to Apple documentation tend to change now and then. You can find an updated list on the book’s website, https://www.nostarch.com/iphoneappsforkids/.

XCODE KEYBOARD SHORTCUTS

You can accomplish everything you need to do in Xcode through a menu item or by clicking an icon. But once you spend a lot of time programming in Xcode, you’ll find that knowing some keyboard shortcuts can be a real time-saver. Table A-1 shows a few common ones you might find helpful.

Table A-1: Xcode Keyboard Shortcuts

Shortcut

Action

-B

Builds the project. This is a good way to test that the code is building properly, with no errors.

-R

Runs the project. This builds the project and then runs it in the currently selected simulator (or device, if you have one attached and selected).

-.

Stops the project from running or cancels an in-progress build.

-SHIFT-Y

Shows or hides the debug area.

-0

Shows or hides the Navigator pane on the left side of the screen.

-1 through -8

Select the various Navigator panes, such as the Project navigator and Issue navigator.

-OPTION-0, -1, and so on

Select the various Utilities panes.

-SHIFT-K

Cleans the project.

-OPTION-SHIFT-K

Cleans the build folder.

-SHIFT-0

Accesses the documentation.

Table A-2:

Shortcut

Action

-/

Comments out the highlighted line(s) of code (or uncomments them if they are already commented out).

-[

Decreases the indentation level of one or more lines of code.

-]

Increases the indentation level of one or more lines of code.

-F

Finds something in the current pane.

-OPTION-F

Finds and replaces something in the current pane.

-SHIFT-F

Finds something anywhere within the entire project by searching across all the project files.

-OPTION-SHIFT-F

Finds and replaces something anywhere within the entire project.

-CONTROL-left arrow

Returns to the previously selected file.

IOS SIMULATOR KEYBOARD SHORTCUTS

The iOS simulator also has some useful keyboard shortcuts, as shown in Table A-2. All of these are easily found as menu items in the simulator.

Table A-3: iOS Simulator Keyboard Shortcuts

Shortcut

Action

-1

Zooms to 100% scale (which is good if you have a big computer screen).

-2

Zooms to 75% scale.

-3

Zooms to 50% scale.

-4

Zooms to 33% scale.

-5

Zooms to 25% scale (which is good if you have a small computer screen).

-left arrow

Rotates the device to the left.

-right arrow

Rotates the device to the right.

-SHIFT-H

Simulates tapping the home button on the device.

-K

Toggles the onscreen keyboard on or off. It works only when a control is selected that uses the keyboard, such as a text field.

-S

Takes a screenshot of the simulator’s screen and saves it to your desktop. This is useful for creating screenshots of your app for the App Store.

XCODE VERSIONS

The code in this book was built using Xcode 8.2.1, so you may want to use that version of Xcode when following along, even if there’s a newer version available. To download older versions of Xcode, log in to your Apple Developer Center account and visit https://developer.apple.com/download/. At the bottom of that page, click the link See more downloads. From there, you should be able to find the download for Xcode 8.2.1.xip, as shown in Figure A-1.

image

Figure A-1: Finding the download link for Xcode 8.2.1

If you’d like to use a newer version of Xcode for the projects in this book, check the book’s website (https://www.nostarch.com/iphoneappsforkids/) for any changes you’ll need to make to the code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset