iOS 15 于 2021 年 9 月发布。但你知道 iOS 15 有多少个二进制文件吗?它使用了哪些编程语言来开发这些应用程序?有多少应用程序是用 Swift 编写的?Apple 是否为某些内置应用程序采用了 SwiftUI?
近日,开发者通过分析 iOS 15 的内置应用得出了结论(这里开发者分析的 iOS 指内核之上的一切东西,不包括 XNU 内核和底层固件)。
iOS 15 中的 Swift 和 SwiftUI
iOS 15 包含 114 个使用 SwiftUI 的二进制文件,几乎是 iOS 14 的 3 倍。同样,包含至少一行 Swift 代码的二进制文件的数量在 iOS 14 和 iOS 15 之间多了差不多两倍:
如图表所示,Apple 继续在其内置应用程序中逐步采用 Swift。今年也是采用 SwiftUI 的重要一年。一些广泛使用的应用程序现在似乎在 iOS 15 中使用 SwiftUI:
- Books
- Maps
- Notes
- Weather
- Tips
- Music
- Podcasts
- FaceTime? (InCallService)
- AppSettings?
还有在 iOS 15 之前就已开始使用 SwiftUI 的 5 个应用:
- Translate
- Shortcuts
- Phone
- AirPods Connect Pop-up? (SharingViewService)
- Lock Screen? (SleepLockScreen)
其他使用 SwiftUI 的二进制文件主要是小部件或新框架。下面是使用 SwiftUI 的 114 个二进制文件的完整列表:
/Applications/AppSettings.app/AppSettings
/Applications/AppStore.app/PlugIns/AppStoreWidgetsExtension.appex/AppStoreWidgetsExtension
/Applications/FamilyControlsAuthenticationUI.app/FamilyControlsAuthenticationUI
/Applications/FindMy.app/PlugIns/FindMyWidgetIntentsItems.appex/FindMyWidgetIntentsItems
/Applications/FindMy.app/PlugIns/FindMyWidgetIntentsPeople.appex/FindMyWidgetIntentsPeople
/Applications/FindMy.app/PlugIns/FindMyWidgetItems.appex/FindMyWidgetItems
/Applications/FindMy.app/PlugIns/FindMyWidgetPeople.appex/FindMyWidgetPeople
/Applications/FTMInternal-4.app/FTMInternal-4
/Applications/GameCenterWidgets.app/PlugIns/GCWidgets.appex/GCWidgets
/Applications/InCallService.app/InCallService
/Applications/PeopleViewService.app/PlugIns/PeopleWidget_iOSExtension.appex/PeopleWidget_iOSExtension
/Applications/SleepWidgetContainer.app/PlugIns/SleepWidgetExtension.appex/SleepWidgetExtension
/private/var/staged_system_apps/Books.app/Books
/private/var/staged_system_apps/Maps.app/Maps
/private/var/staged_system_apps/MobileMail.app/PlugIns/MailWidgetExtension.appex/MailWidgetExtension
/private/var/staged_system_apps/MobileNotes.app/MobileNotes
/private/var/staged_system_apps/MobileNotes.app/PlugIns/com.apple.mobilenotes.SharingExtension.appex/com.apple.mobilenotes.SharingExtension
/private/var/staged_system_apps/Music.app/Frameworks/MusicApplication.framework/MusicApplication
/private/var/staged_system_apps/Podcasts.app/Frameworks/PodcastsStoreUI.framework/PodcastsStoreUI
/private/var/staged_system_apps/Shortcuts.app/PlugIns/QuickLookExtension.appex/QuickLookExtension
/private/var/staged_system_apps/Tips.app/Tips
/private/var/staged_system_apps/Weather.app/Weather
/System/Library/Assistant/UIPlugins/SiriFindMyUIPlugin.siriUIBundle/SiriFindMyUIPlugin
/System/Library/Frameworks/_CoreLocationUI_SwiftUI.framework/_CoreLocationUI_SwiftUI
/System/Library/Frameworks/_MusicKit_SwiftUI.framework/_MusicKit_SwiftUI
/System/Library/Frameworks/FamilyControls.framework/FamilyControls
/System/Library/Frameworks/FamilyControls.framework/PlugIns/ActivityPickerExtension.appex/ActivityPickerExtension
/System/Library/Health/FeedItemPlugins/Heart.healthplugin/Heart
/System/Library/Health/FeedItemPlugins/Highlights.healthplugin/Highlights
/System/Library/Health/FeedItemPlugins/MenstrualCyclesAppPlugin.healthplugin/MenstrualCyclesAppPlugin
/System/Library/Health/FeedItemPlugins/SleepHealthAppPlugin.healthplugin/SleepHealthAppPlugin
/System/Library/Health/FeedItemPlugins/Summaries.healthplugin/Summaries
/System/Library/PreferenceBundles/BatteryUsageUI.bundle/BatteryUsageUI
/System/Library/PreferenceBundles/CoreRoutineSettings.bundle/CoreRoutineSettings
/System/Library/PreferenceBundles/FocusSettings.bundle/FocusSettings
/System/Library/PrivateFrameworks/AccessibilitySharedUISupport.framework/AccessibilitySharedUISupport
/System/Library/PrivateFrameworks/ActionKitUI.framework/ActionKitUI
/System/Library/PrivateFrameworks/CommandAndControlUI.framework/CommandAndControlUI
/System/Library/PrivateFrameworks/CoreChartSwift.framework/CoreChartSwift
/System/Library/PrivateFrameworks/CoreSuggestionsUI.framework/CoreSuggestionsUI
/System/Library/PrivateFrameworks/FocusSettingsUI.framework/FocusSettingsUI
/System/Library/PrivateFrameworks/FocusUI.framework/FocusUI
/System/Library/PrivateFrameworks/HealthExperienceUI.framework/HealthExperienceUI
/System/Library/PrivateFrameworks/HealthRecordsUI.framework/HealthRecordsUI
/System/Library/PrivateFrameworks/HealthVisualization.framework/HealthVisualization
/System/Library/PrivateFrameworks/HearingUI.framework/HearingUI
/System/Library/PrivateFrameworks/MediaFoundation.framework/MediaFoundation
/System/Library/PrivateFrameworks/MessagesSupport.framework/MessagesSupport
/System/Library/PrivateFrameworks/MLKit.framework/MLKit
/System/Library/PrivateFrameworks/MLKit.framework/PlugIns/com.apple.MLKit.MLModelPreview.appex/com.apple.MLKit.MLModelPreview
/System/Library/PrivateFrameworks/MLKit.framework/PlugIns/com.apple.MLKit.MLPackagePreview.appex/com.apple.MLKit.MLPackagePreview
/System/Library/PrivateFrameworks/NotesUI.framework/NotesUI
/System/Library/PrivateFrameworks/PaymentUI.framework/PaymentUI
/System/Library/PrivateFrameworks/PeopleUI.framework/PeopleUI
/System/Library/PrivateFrameworks/PreviewsInjection.framework/PreviewsInjection
/System/Library/PrivateFrameworks/PreviewsMessaging.framework/PreviewsMessaging
/System/Library/PrivateFrameworks/ScreenTimeUICore.framework/ScreenTimeUICore
/System/Library/PrivateFrameworks/SleepHealthUI.framework/SleepHealthUI
/System/Library/PrivateFrameworks/SleepWidgetUI.framework/SleepWidgetUI
/System/Library/PrivateFrameworks/SnippetUI.framework/SnippetUI
/System/Library/PrivateFrameworks/TipKit.framework/TipKit
/System/Library/PrivateFrameworks/TranslationUI.framework/TranslationUI
/System/Library/PrivateFrameworks/TranslationUIServices.framework/PlugIns/TranslationUIService.appex/TranslationUIService
/System/Library/PrivateFrameworks/VideosUI.framework/VideosUI
/System/Library/PrivateFrameworks/WeatherUI.framework/WeatherUI
/System/Library/PrivateFrameworks/WorkflowUI.framework/WorkflowUI
/System/Library/Snippets/UIPlugins/AudioUIPlugin.bundle/AudioUIPlugin
/System/Library/Snippets/UIPlugins/SiriVideoUIPlugin.bundle/SiriVideoUIPlugin
/System/Library/Snippets/UIPlugins/SystemPlugin.bundle/SystemPlugin
/usr/lib/swift/libswiftExtensionKit.dylib
/usr/libexec/proximitycontrold
二进制文件总数
iOS 15 由 4738 个二进制文件组成,高于 iOS 14 中的 4173 个,新增了 565 个新二进制文件。
编程语言的演变
通过分析从 iPhone OS 1.0 到 iOS 15 的所有 iOS 主要版本,可以看到 iOS 使用的编程语言的演变。请注意,单个二进制文件可以计算多次,因此下图中二进制文件的总和大于二进制文件的总数:
在 iOS 15 中的所有二进制文件中:
- 89% 使用 Objective-C
- 17% 使用 C++
- 13% 使用 Swift
- 8% 完全用 C 编写
- 2% 使用 SwiftUI
由此可见:
- Objective-C 仍然是 iOS 的核心
- Apple 对 Swift 的使用比以往任何时候都更快。去年 Swift 的代码量比例超过了 C,今年则越来越接近 C++
- SwiftUI 去年几乎没有引起人们的注意,但今年 Apple 似乎更广泛地采用了它,即使是在旗舰应用程序中
- C++ 和 C 仍然扮演着重要的角色。这些语言通常由与音频、视频、电话、Web 和其他底层框架相关的二进制文件使用
下图是每种编程语言演变的另一种表示形式:
最后,这名开发者提供了原始数据,如果你也希望进行更深入的分析,可查看从 iPhone OS 1.0 到 iOS 15.0 的所有主要 iOS 版本生成的原始数据。
Version | Device | Raw Data |
---|---|---|
iOS 15.0 (19A346) | iPhone 13 Pro | iOS15.txt |
iOS 14.0 (18A373) | iPhone X | iOS14.txt |
iOS 13.1 (17A844) | iPhone X | iOS13.txt |
iOS 12.0 (16A366) | iPhone X | iOS12.txt |
iOS 11.1 (15B93) | iPhone X | iOS11.txt |
iOS 10.1 (14B72) | iPhone 5s | iOS10.txt |
iOS 9.0 (13A344) | iPhone 5s | iOS9.txt |
iOS 8.0 (12A365) | iPhone 5s | iOS8.txt |
iOS 7.0.1 (11A470a) | iPhone 5s | iOS7.txt |
iOS 6.0 (10A403) | iPhone 3GS | iOS6.txt |
iOS 5.0 (9A334) | iPhone 3GS | iOS5.txt |
iOS 4.0 (8A293) | iPhone 3GS | iOS4.txt |
iPhone OS 3.0 (7A341) | iPhone 3GS | iOS3.txt |
iPhone OS 2.0 (5A347) | iPhone 2G | iOS2.txt |
iPhone OS 1.0 (1A543a) | iPhone 2G | iOS1.txt |