Little big improvements in Xcode 14
source link: https://sarunw.com/posts/little-big-improvements-xcode14/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Little big improvements in Xcode 14
Table of Contents
Xcode 14 brings a lot of little big improvements. Here are six of them which I found out.
You can easily support sarunw.com by checking out this sponsor.
Sponsor sarunw.com and reach thousands of iOS developers.
Sticky Scope
I don't know the official name of this feature just yet, so I called it "Sticky Scope".
When you scroll through the code, you might get lost in the context and don't know whether you are in a class, extension, or function scope. Xcode 14, pin the current scope you are in at the top of the editor.
Lovely improvement.
Sticky Scope.
Memberwise initializer snippet
In the previous version of Xcode, Xcode could generate a memberwise initializer for us. But the action is hidden deep down in the context menu.
Old way to generate memberwise initializer.
In Xcode 14, Apple surface this up in the form of code snippet.
You can generate a memberwise initializer by typing init
.
New snippet to generate memberwise initializer.
Add Codable implementation snippets
Making your model conform to Codable
contain a lot of boilerplate code.
Luckily, in Xcode 14, we have three snippets to generate Codable-related code.
Typing coding
, init
, and encode
should prompt you to generate CodingKeys
, Decodable
's initializer, and Encodable
's encoder, respectively.
Code snippets for Codable.
Your model needs to conform to the Codable
protocol before you can see these snippets.
You can also do all of that in one go with action from a context menu.
Add explicit Codable implementation.
Single asset for App Icon
I think this is one of the most requested features since the dawn of time. Xcode now requires only a single 1024x1024 image that is automatically resized for its target.
Xcode now requires only a single 1024x1024 image for an app icon.
Better code completion
Code completion always returns all possible parameters, which is quite annoying when you only want some of them.
Xcode 14 improves this by only inserting parameters that match the search term.
In this example, I add a .frame
modifier with the maxWidth
parameter by typing "framemaxwi".
Code completion only insert parameter which matches the search term.
If you want all parameters, you can hold down an option key (⌥) and hit return.
You can easily support sarunw.com by checking out this sponsor.
Sponsor sarunw.com and reach thousands of iOS developers.
Auto re-indent
Xcode 14 will auto re-indent an inner content when you type closing brace.
Auto re-indent.
You may also like
Create a reusable boilerplate snippet that you can use in the project.
XcodeLeaning tips and tricks about the tool will help you down the road. Today, I will show you 4 Xcode shortcuts that I find helpful when dealing with SwiftUI.
XcodeA tip for creating multiple schemes to quickly run your app in different languages.
XcodeRead more article about Xcode, WWDC22,
or see all available topic
Enjoy the read?
If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.
Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.
If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.
How to add a TextField to Alert in SwiftUI
iOS 16 add the ability to integrate a text field in an alert.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK