iOS 15 中 Swift 和 SwiftUI 的使用情況
iOS 15 于 2021 年 9 月發(fā)布。但你知道 iOS 15 有多少個二進制文件嗎?它使用了哪些編程語言來開發(fā)這些應(yīng)用程序?有多少應(yīng)用程序是用 Swift 編寫的?Apple 是否為某些內(nèi)置應(yīng)用程序采用了 SwiftUI?
近日,開發(fā)者通過分析 iOS 15 的內(nèi)置應(yīng)用得出了結(jié)論(這里開發(fā)者分析的 iOS 指內(nèi)核之上的一切東西,不包括 XNU 內(nèi)核和底層固件)。
iOS 15 中的 Swift 和 SwiftUI
iOS 15 包含 114 個使用 SwiftUI 的二進制文件,幾乎是 iOS 14 的 3 倍。同樣,包含至少一行 Swift 代碼的二進制文件的數(shù)量在 iOS 14 和 iOS 15 之間多了差不多兩倍:
如圖表所示,Apple 繼續(xù)在其內(nèi)置應(yīng)用程序中逐步采用 Swift。今年也是采用 SwiftUI 的重要一年。一些廣泛使用的應(yīng)用程序現(xiàn)在似乎在 iOS 15 中使用 SwiftUI:
- Books
 - Maps
 - Notes
 - Weather
 - Tips
 - Music
 - Podcasts
 - FaceTime? (InCallService)
 - AppSettings?
 
還有在 iOS 15 之前就已開始使用 SwiftUI 的 5 個應(yīng)用:
- 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
 
二進制文件總數(shù)
iOS 15 由 4738 個二進制文件組成,高于 iOS 14 中的 4173 個,新增了 565 個新二進制文件。
編程語言的演變
通過分析從 iPhone OS 1.0 到 iOS 15 的所有 iOS 主要版本,可以看到 iOS 使用的編程語言的演變。請注意,單個二進制文件可以計算多次,因此下圖中二進制文件的總和大于二進制文件的總數(shù):
在 iOS 15 中的所有二進制文件中:
- 89% 使用 Objective-C
 - 17% 使用 C++
 - 13% 使用 Swift
 - 8% 完全用 C 編寫
 - 2% 使用 SwiftUI
 
由此可見:
- Objective-C 仍然是 iOS 的核心
 - Apple 對 Swift 的使用比以往任何時候都更快。去年 Swift 的代碼量比例超過了 C,今年則越來越接近 C++
 - SwiftUI 去年幾乎沒有引起人們的注意,但今年 Apple 似乎更廣泛地采用了它,即使是在旗艦應(yīng)用程序中
 - C++ 和 C 仍然扮演著重要的角色。這些語言通常由與音頻、視頻、電話、Web 和其他底層框架相關(guān)的二進制文件使用
 
下圖是每種編程語言演變的另一種表示形式:
最后,這名開發(fā)者提供了原始數(shù)據(jù),如果你也希望進行更深入的分析,可查看從 iPhone OS 1.0 到 iOS 15.0 的所有主要 iOS 版本生成的原始數(shù)據(jù)。
本文轉(zhuǎn)自O(shè)SCHINA
本文標(biāo)題:iOS 15 中 Swift 和 SwiftUI 的使用情況
本文地址:https://www.oschina.net/news/174934/state-of-swift-and-swiftui-ios15





















 
 
 


 
 
 
 