Now Reading
Apple’s use of Swift and SwiftUI in iOS 17

Apple’s use of Swift and SwiftUI in iOS 17

2023-10-19 14:48:49

Now that iOS 17 is out there, let’s analyze its built-in apps to reply a couple of questions: What number of binaries are in iOS 17? Which programming languages are used to develop these apps? What number of apps are written with Swift? What’s the share of apps utilizing SwiftUI versus UIKit?

The methodology and instruments to create this text have been detailed in my earlier posts. In case you are , please discuss with:

Earlier than leaping into the small print, let’s make clear a couple of factors:

  • I solely analyzed what is often known as ‘iOS’, i.e. all the pieces above the kernel. The XNU kernel and low-level firmwares will not be included. Notice that this yr, I analyzed the Safe Enclave.

  • I counted the frameworks situated contained in the dyld shared cache, a mechanism launched in iPhone OS 3.1.

  • Understand that a developer can combine completely different programming languages to create one binary. One instance is a Mac app I developed, Dependencies, the place I take advantage of Swift, Goal-C, C++, and C, essentially the most acceptable programming language used to resolve every particular downside. On this article, an app containing a single line of Swift code might be counted as utilizing Swift.

  • You will notice mentions of Goal-C and C++ however you would possibly discover the absence of Goal-C++. The strategy used right here can’t actually detect binaries constructed with Goal-C++. Such binaries are counted as utilizing each Goal-C and C++.

  • Lastly, you need to take this evaluation with a grain of salt. Whereas I imagine the general image to be correct, my strategy has some limitations as a result of I don’t have entry to the iOS supply code and relied on imprecise compilation artifacts.

Let’s first reply a easy query: What number of binaries are in iOS 17? The variety of binaries composing iOS continues to extend: iOS 17 incorporates 6030 binaries, up from 5403 in iOS 16. That’s 627 new binaries.

Unsurprisingly, there was a big enhance within the variety of apps adopting SwiftUI this yr. Notable mentions embrace:

  • The Preferences app with a number of of its bundles (StorageSettingsUI, WallpaperSettings, MultitaskingAndGesturesSettings, ThirdPartyApplicationSettings, ActionButtonSettings, …)
  • A number of binaries associated to Well being (Well being.app, HealthUI, MentalHealthUI, WorkoutUI, …)
  • The Residence app, which seems to have undergone some main modifications (Residence.app, HomeEnergyUI, HomeUICommon, HomeDataModel, HomeAccessoryControlUI, …)
  • The assist for the brand new Motion button (ActionButtonSettings, ActionButtonConfigurationUI, …)
  • Moreover, a number of different vital apps, comparable to Calendar and Reminders, are actually utilizing SwiftUI

In iOS 16, solely 4 apps used the SwiftUI-based app lifecycle. In iOS 17, this determine has grown to 14 apps:

/Functions/Batteries.app/Batteries
/Functions/ClarityCamera.app/ClarityCamera
/Functions/ClarityPhotos.app/ClarityPhotos
/Functions/FinanceUIService.app/FinanceUIService
/Functions/FTMInternal-4.app/FTMInternal-4
/Functions/MusicRecognition.app/MusicRecognition
/Functions/PASViewService.app/PASViewService
/Functions/Preferences.app/Preferences
/Functions/SafetyMonitorApp.app/SafetyMonitorApp
/Functions/ShazamEventsApp.app/ShazamEventsApp
/Functions/WorkoutRemoteViewService.app/WorkoutRemoteViewService
/non-public/var/staged_system_apps/Climate.app/Climate
/System/Library/CoreServices/AegirProxyApp.app/AegirProxyApp
/System/Library/CoreServices/ShortcutsActions.app/ShortcutsActions

The Swift and SwiftUI adoption continues its climb: iOS 17 now incorporates 385 binaries utilizing SwiftUI. Likewise the variety of binaries containing not less than one line of Swift code elevated by 50% between iOS 16 and iOS 17:

By analyzing all main releases of iOS from iPhone OS 1.0 to iOS 17, we are able to see the evolution of the programming languages utilized by iOS. Once more please word {that a} single binary will be counted a number of instances, so the sum of the binaries on this graph is bigger than the whole variety of binaries:

Some traits will be higher visualized by displaying percentages:

What can we be taught from these graphs?

  • Goal-C continues to be on the core of iOS and is used immediately or not directly by most apps
  • The adoption of Swift and SwiftUI continues to develop quickly
  • The share of Goal-C, C and C++ continues to lower

Up till now, we in contrast SwiftUI to all binaries. SwiftUI being a UI framework, it will be fairer to match it to different binaries displaying some UI. Native iOS apps will be constructed with 2 completely different UI frameworks: UIKit and SwiftUI (word that it’s doable to combine each). My strategy to depend the variety of binaries containing UI shouldn’t be excellent however ought to give an approximate pattern: I merely verify if the binaries hyperlink towards the UIKit or SwiftUI frameworks.

For the primary time, the variety of binaries solely utilizing UIKit has decreased compared to the earlier yr:

By displaying percentages, we are able to verify that SwiftUI is clearly growing in Apple’s personal apps:

The Safe Enclave is a hardware-based safety element, remoted from the primary processor to supply an additional layer of safety. It was initially launched with the iPhone 5S to make sure the safety of delicate consumer knowledge, taking part in a important position for Contact ID, Face ID, and Apple Pay.

See Also

Within the What's new in Swift session (5:35) of the WWDC22, Apple said that Swift is now appropriate for restricted environments just like the Safe Enclave Processor:

In iOS 17, the Safe Enclave incorporates 19 binaries, and to my shock, none of them are utilizing Swift:

So is Swift used within the Safe Enclave? Sure! It seems that the hibernation binary in macOS Ventura is utilizing Swift:

You’ll be able to obtain beneath the uncooked knowledge I generated for all main releases of iOS from iPhone OS 1.0 to iOS 17.0.

Despite the fact that we don’t have entry to the iOS supply code, we are able to decide the programming languages used to create the built-in apps in iOS and we are able to measure the evolution of those languages from iPhone OS 1.0 to iOS 17.

Swift and SwiftUI adoptions proceed their progress: the variety of binaries utilizing these frameworks elevated by 50% between iOS 16 and iOS 17. One other good signal of dogfooding is the extra widespread use of the SwiftUI-based app lifecycle. Additionally for the primary time, the variety of binaries solely utilizing UIKit has decreased compared to the earlier yr.

Within the upcoming years, it will likely be fascinating to look at whether or not Swift begins to unfold into low-level firmware, such because the Safe Enclave. At present, Swift is absent from the Safe Enclave in iOS, though macOS does incorporate it.

As beforehand talked about, this strategy has clearly some limits and whereas I imagine the general image to be correct, I can’t assure that the outcomes are completely precise. When you assume that I missed one thing, please reach out to me on Mastodon @timac@mastodon.social.

Source Link

What's Your Reaction?
Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top