UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Optimizing your app

Forums > iOS

Ok guys, when you have an app that you've designed to run on iOS 14 or later. What does it mean to optimize the app. I have over the last few years seen a few of the apps I use say they are optimizing for iOS **. So Im just curious on what does that mean. Sorry for the very newbie question.

4      

This is a great question!

Please watch Paul's recent video Hiding The Keyboard.

In this video Paul discusses a problem with hiding a numeric keyboard after entering a dollar amount.

This was solvable with older versions of iOS. But, indeed, it was a pain.

With recent updates to iOS, the Swift language received a new state variable named @FocusState. This gracefully solves the keyboard problem in a very Swifty (declarative!) way.

So, if a developer says they are optimizing for iOS 15, one thing they might be doing is stripping their application of the previous keyboard hiding hacks, and implementing a more elegant @FocusState based solution.

In this case the optimization may not make the application any faster. (This is a common understanding of optimization.) But it will certainly make the application easier for the developer to maintain and improve.

4      

Thanks, @Oblelix, Sorry, I have been off the grid for a bit dealing with some health issues and other things. I do appreciate this explanation. So, my next question is this. Lets say you have an app that was made to run on iOS14 but you want to take advatage of some of the new things in iOS15. For example the .searchable. How does one go about keeping the custom searchbar you had in iOS 14 but allow the app to use .searchable if the user is on iOS15 or later?

4      

Another Swift developer you'll want to follow, Antoine van der Lee, has a great article on this....

How to use the #available attribute in Swift

To be honest, though, I have not tried this technique. One of my pandemic goals was to learn Swift and publish an app on the App Store. So, for now, my goal is just to get something working! If I can convince more than a handful of friends and my mum to download it, I'll start thinking about folks on older devices!

Post here! Let us all know how this works for you and what caused you the most grief. (So we can learn from you!)

4      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.