February 7th, 2022
Filed under: Xcode | Be the first to comment!
If you create a new project in Xcode 13, you will notice there is no Info.plist
file on the left side of the project window. How do you access Info.plist
and add items to it?
The Custom Target Properties section contains the Info.plist
file. Add, edit, and remove entries from there. Move the mouse arrow over an entry to show buttons for adding and removing entries.
October 7th, 2021
Filed under: Xcode | Be the first to comment!
The Xcode 13 betas included the macOS 12 SDK. When Apple released iOS 15, they released Xcode 13.0. Because macOS 12 was still in beta during iOS 15’s release, Xcode 13.0 includes the macOS 11.3 SDK.
If you are writing a Mac app that uses something added in the macOS 12 SDK, such as SwiftUI’s element binding syntax, the code won’t compile, even if the new feature supports macOS 11.
To use the macOS 12 SDK, install one of the Xcode 13 betas until Apple releases macOS 12. When Apple ships macOS 12, they will ship a new Xcode version that includes the macOS 12 SDK.
Apple released Xcode 13.1 on October 25, 2021. Xcode 13.1 includes the macOS 12 SDK.
September 28th, 2021
Filed under: Xcode | Be the first to comment!
When you create a new project in Xcode 13, you will notice there is no Products folder in the project navigator. Choose Product > Show Build Folder in Finder to access the Products folder.
November 15th, 2020
Filed under: Xcode | Be the first to comment!
In Xcode 12 Apple consolidated many of their iOS app project templates into one template: App. If you are following a tutorial written for an older Xcode version that has templates like single view app and master-detail app, choose the App template.
October 3rd, 2020
Filed under: None | Be the first to comment!
I see many people who ask a programming question on Reddit and do one of two things to show their code:
By doing these things, the people asking the question make their code extremely difficult to read, making it less likely they will get an answer.
Notice how the code isn’t indented properly in the inline code block above. This sample isn’t too bad, but I have seen long inline code blocks that are almost unreadable.
The way to make a code listing readable on Reddit is to create a Markdown code block. Start by clicking the Markdown mode button on the right side of the toolbar above the text view for writing the post.
Write your post in Markdown. Any paragraphs you write will appear as normal body text in the final post. To create a code block, put three backticks on the line above the code listing and three more on the line below the listing.
```
// Put your code listing here
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
}
```
Then we you click the Post button, your code listing will appear in a block similar to the listing above, minus the backticks above and below the code.
By using Markdown code blocks for code listings in Reddit, your code will be much easier to read. People will be more likely to answer your question because you took the time to make an easy to read listing.
October 1st, 2020
Filed under: Xcode | Be the first to comment!
As part of Xcode 12, Apple added project templates for creating SwiftUI apps that run on both iOS devices and Macs. In the Xcode 12 betas, these project templates appeared in the Multiplatform section.
When Apple released iOS 14 in September, they also released Xcode 12.0. If you install Xcode 12.0 and create a project, you will see that the App and Document App projects are missing from the Multiplatform section. What happened?
The App and Document App templates require the macOS 11 SDK. Because macOS 11 was still in beta when Xcode 12.0 shipped, Apple did not include the macOS 11 SDK in Xcode 12.0. That’s why the App and Document App templates are missing in Xcode 12.0. No macOS 11 SDK, no App and Document App templates.
If you want to use the App and Document App templates, you must install Xcode 12.2, which includes the macOS 11 SDK. Apple will release Xcode 12.2 when macOS 11 ships. If you can’t wait for macOS 11 to ship, download the Xcode 12.2 beta.
UPDATE: November 2020
Xcode 12.2 is now available at the Mac App Store, and it includes the multiplatform SwiftUI project templates.
August 11th, 2020
Filed under: Xcode | Be the first to comment!
If your Xcode project has multiple targets and you add a Swift package, Xcode will let you add the package to only one of the targets. How do you add the package to the other targets?
Select a target from the project editor. Click the Add button in the Frameworks, Libraries, and Embedded Content section.
A sheet will open with a list of frameworks and libraries that you can add. The Swift package will appear in the list.
April 29th, 2020
Filed under: Xcode | Be the first to comment!
People constantly post on Apple’s developer forums complaining that when they try to install Xcode, an alert opens saying they don’t have enough disk space to install it. These people always say they have enough space because they have more free space on their disk than the Xcode download. Usually the person asking the question has 15–20 GB of free space on their startup disk.
The Xcode file that you download is a compressed file. You need enough disk space to store both the compressed file you downloaded and the expanded file. Suppose your Xcode download is 8 GB. The expanded file is going to be bigger than that. Xcode 11.4.1 takes up 17.39 GB on my Mac. At this point you need 25.39 GB of free space. Add in some temporary storage space for swapping files, and you need a minimum of 30 GB of disk space to install Xcode.
30 GB of disk space is just an example. That may not be enough free space, especially for newer Xcode versions. Xcode releases keep getting larger over time so the amount of free disk space you need will increase as well.
If an alert opens saying you don’t have enough space to install Xcode, you don’t. Have enough free disk space that is at least 5 times the size of the compressed Xcode file you are going to download from Apple. I know that can be hard to do, especially if you are using a laptop with a 128 GB SSD, but you have to free up the space.
The app DevCleaner for Xcode can free up gigabytes of disk space by removing caches and other old files that accumulate over time.
January 23rd, 2020
Filed under: Xcode | Be the first to comment!
Xcode 11 provides a subtle button to export a Mac app archive. In the Organizer, select an archive and scroll so you can see the Status column for the archive. Move the cursor over the Status column to make the Export App button appear.
October 19th, 2019
Filed under: Version Control, Xcode | Be the first to comment!
This post lists all the changes I found in Xcode 11 on version control.
Xcode 11 adds a code review button to the toolbar that lets you view the changes you made to the currently selected file.
The code review button is the button with the two arrows facing right and left.
When you make changes to your source code, a blue bar appears on the left side of the editor next to the changed code.
If you click the blue bar, a popover opens that lets you discard the change you made to that block of code.
In Xcode 11 you can stash uncommitted changes in Xcode. Stashing changes lets you temporarily store changes you make to your code so you can switch branches. Stashing is potentially dangerous. If you mistakenly remove a stash, you can’t get it back. It’s safer to create a temporary branch and commit your changes to the temporary branch.
Choose Source Control > Stash Changes to stash your changes. A sheet opens for you to enter an optional message. Click the Stash button to complete the stash.
You can view your stashes from the source control navigator. The stashes are in the Stashed Changes folder. Select a stash to view the changes you made.
Right-clicking on a stash opens a contextual menu that lets you apply and delete your stashes.
Xcode 11 adds support for cherry picking commits. Cherry picking involves taking a commit from one git branch and applying it to another.
To cherry pick a commit, switch to the branch where you want to apply the cherry pick. Choose Source Control > Cherry Pick.
A sheet opens for you to enter a revision identifier, which is the identifier git supplies for a commit. Finding the revision identifier for the commit you want to cherry pick is the hardest part. When you enter a valid identifier, the commit will appear in the list of commits. Select the commit and click the Cherry-Pick button to cherry pick the commit.