Introduction
Xcode is the development environment used to develop IOS, Mac OS, Watch OS and TV OS apps. Normally, Swift is used as the programming language. If you are blind and want to learn Swift, I highly recommend the 100 Days Of SwiftUI tutorial from Paul Hudson’s web site SwiftUI is Apple’s latest framework for developing user interfaces. The previous framework, UIKit can still be used, but this is more difficult for a blind person since it depends on story boards and dragging/dropping. Both are visual concepts. SwiftUI can be done completely by typing code pretty easily. This lesson assumes that you have a Mac computer running Mac OS Catalina or later. This lesson also assumes that you are familiar with VoiceOver navigation including interacting with objects. Whenever you see “VO” that means to hold down the Control and Option keys. Since Xcode’s simulator does not work with VoiceOver, you will need to Sign up for a developer account. in order to test apps on a real device. With all of that out of the way, let’s get started.
Installing XCode
Xcode can be installed from the Mac OS App Store. To open the App Store, press VO M to open the Apple menu then VO Down Arrow to App Store. Press Enter. To search for Xcode, press Command F. Type the word “Xcode” then press Enter. VO Left or Right Arrow until VoiceOver says “results for Xcode.” Then interact with the results. VO Left or Right Arrow until you hear the Redownload button for Xcode. VO Space on that button. After you press VO Space on that button, Xcode will not start downloading yet. You will need to VO Left or Right Arrow until you find the Redownload button again. Then press VO Space on that button again. After that, wait a minute to see if Xcode starts downloading. Xcode usually takes a while to download, so find something else to do then check back in a half an hour. After Xcode finishes downloading, an Open button will appear. You can either open Xcode with that button or open it from the Spotlight or the Applications folder.
Creating and Opening Projects
When Xcode opens, it opens with your list of recent projects and a button to create a new Xcode project. Once you create at least one project, you can interact with the Recent Projects table then VO Left or Right Arrow until you get to the project you want to open. Then press Enter. If you have not created any projects yet, you will not interact with this table. Instead, VO Right Arrow until you get to the option to create a new Xcode project. Then press VO Space. Once you VO Space on the button to create a new project, a box will come up that asks you to choose platform and template. First, VO Left/Right arrow in order to find the section that VoiceOver calls “platform radio group” then interact with that section. VO Left/Right until you get to the platform you want then press VO Space. For example, if you want to develop an iPhone or iPad app, you would VO Space on IOS. Stop interacting with the “platform radio group.” Vo Right Arrow until you get to the template chooser and interact with that. Then interact with the Application Section. Vo Left or Right Arrow until you get to App then press VO Space. Stop interacting with both the Application section and the template chooser. The platform and template you just picked will be the default from now on, so the next time you create a project you will not need to interact with the platform or template section. VO Right Arrow until you find Next then press VO Space. Another window will come up. VO Right Arrow until you find the box to type your product name. The name you type hear wil be the name of the app when you run it on a device. Vo Right Arrow through the options and make sure SwiftUI is the selected interface. Vo Right Arrow until you get to the Next button and press VO Space. Another window will come up that asks where you want to save the project. If you don’t want to change this, press VO Right Arrow until you get to Create and press VO Space. Wait a minute for Xcode to create your project.
tips for Xcode navigation
In Xcode 11, I was placed in one of the Swift source files whenever I opened or created a project. I noticed that in Xcode 12, I am now placed in a table with my list of source files. If you find yourself placed in this table, you can just interact with the table then VO Left/Right Arrow until you find the source file you want to edit. If you are brand new to Swift, go ahead and look for contentview.swift. Press VO J until you are in the source code editor. VO J is sometimes used in Mac OS apps to jump to different sections of a window. When you are in the source code editor, you can use the Up/Down arrow keys to move by line and Left/Right arrow moves by letter. Option Left/Right Arrow moves by word. Command Up Arrow goes to the top of the source file and Command Down Arrow goes to the bottom. Command Left Arrow goes to the beginning of the line and Command Right Arrow goes to the end of a line.
Before you run your code, you will need to have your IOS device that you are going to use to run your code connected to your computer at least for the first time you run an app. If you want, you can configure Xcode to use the device wirelessly after that. After your device is connected to your computer, set the destination in Xcode to that device. To do this, press VO M to open the menu. VO Right Arrow until you get to the Product menu. VO Down Arrow until you get to Destination submenu then press VO Right Arrow. VO Down Arrow until you get to your device then press VO Space. For example, I run the code on my iPhone most of the time, so I usually VO Down Arrow to iPhone. When you are done editing your code, you can press Command R to run the program. Hopefully, after a minute or two, VoiceOver will say “build succeeded.”. If you hear that message, life is good and you can just wait a minute for the app to open on your device. Often, especially when you are a beginner, you will get another message, “build failed.” When you get this message, you will need to figure out why the build failed. To get a list of error messages, press Command 5 to go to Issue Navigator. Interact with the table. VO Left/Right Arrow to go through the list. While you are on an error message, you can press VO J until you get back to the source editor. You will be placed on the line that that particular error message referred to. Try to fix the error then try running the code again. If you don’t know how to fix the error, you may need to review sections of the Swift tutorial you are using. If you still can’t figure out the error, try putting the error message into Google or another search engine.
The more you work with Swift, you will need to work on more than one source file in your project. To create a new Swift source file, press Command N. Xcode will ask you to choose a template for your new file. If you are a beginner and you don’t know what to choose, just choose SwiftUI file. VO Right Arrow until you get to the template chooser. SwiftUI may already be chosen. If it is, then you don’t need to do anything with this. If not, Interact with the template chooser and find SwiftUI. Then stop interacting. VO Right Arrow until you find the Next button then press VO Space. Type a name for the file. You do not need to include the .swift extension since Xcode automatically adds it. Find the Create button then press VO Space. When you have more than one source file to work on, you can press Command 1 to open the Project Navigator. Interact with the table. VO Left or Right Arrow until you find the file you want to edit. After you find the file you are looking for, press VO J until you get back to the source editor.
Adding Pictures and Other Files
Sometimes, you will need to add pictures or other files to your project. Adding pictures is a little bit diffferent than adding other files, so I will start with that. To add a picture, do the following:
- Press Command 1 to open the Project navigator and interact with it.
- Press VO Left or Right Arrow until you find Assets.xcassets then press VO J.
- Stop interacting.
- Vo Right Arrow until you find an option to add group or image set.
- press VO Space.
- VO Down Arrow to Import then press VO Space.
- A box will come up that asks what files you want to add. Chances are that the files you want are somewhere in your home folder. To open your home folder, type the “/” key. Then type users/whatever your home folder is. Press Enter. If you don’t know your home folder is, open Terminal. Type “echo $HOME” then press Return.
- Interact with the list of files and folders in your home folder. If you haven’t already previously done this, I recommend you press Command 1 to show the files and folders as icons.
- Find the folder with the pictures then press VO Space.
- Interact with the folder.
- If you want to select all of the pictures in the folder, press Command A to select all of the pictures.
- Vo Right Arrow to open then press VO Space.
To add other files such as .json or audio files, do the following:
- Press Command 1 to open Project Navigator.
- Press Command Option A.
- What you want to add is probably in your home folder. Press the “/” key. Type users/YourHomeFolder then press Enter.
- Interact with the Icon View collection which is the list of files and folders in your home folder.
- Find the folder with the file you want to add.
- Press Vo Space.
- Interact with the folder.
- Find the file you want to add then stop interacting.
- Keep pressing VO Right Arrow and make sure the box is checked to copy items if needed. If it is not checked, press VO Space to check it.
- VO Right Arrow to the Add button then press VO Space.
Conclusion
I hope this post helped you familiarize you with Xcode enough that you can follow one of the Swift tutorials on the web. The Swift Tutorial I am using is the 100 Days of SwiftUI tutorial. The idea is that you work with Swift for an hour each day. I don’t always follow that. I have a full time job and other things going on, so I skip days. Still, there is a lot of information in that tutorial and other articles on the Hacking With Swift web site.