查看原文
其他

开发者注意!盘一盘 iOS 14 中 Swift 和 SwiftUI 的使用情况

Alexandre CSDN 2020-12-18
作者 | Alexandre Colucci
译者 | 弯月,责编 | 杨碧玉
头图 | CSDN 下载自东方 IC
出品 | CSDN(ID:CSDNnews)

以下为译文:

在2014年的全球开发者大会上,苹果推出了Swift。这些年来,我一直在分析iOS,统计有多少内置应用程序在使用Swift。2015年发布的iOS 9包含一个使用Swift编写的应用程序:计算器。从那以后,每个iOS版本的发布中,使用Swift编写的应用程序数量越来越多:iOS 10.1、iOS 11.1、iOS 12.0以及最后的iOS 13.1

现今,苹果推出了iOS 14,下面我们一起来看看自iOS 13以来,使用Swift编写的应用程序数量又增加了多少。一年前,在2019年的全球开发者大会上,苹果推出了SwiftUI。在本文中,我还将尝试评估哪些内置应用程序正在使用这个最新的UI框架。


iOS 14中Swift的使用情况


iOS14.0包含351个使用Swift编写的二进制文件和框架。请注意,这些二进制文件可能只包含一行Swift代码,不一定完全用Swift编写。该列表是以面向iPhone 11 Pro Max的iOS 14.0(18A373)为基础编制的:

/Applications/ActivityMessagesApp.app/PlugIns/ActivityMessagesExtension.appex/ActivityMessagesExtension/Applications/AppStore.app/AppStore/Applications/AppStore.app/PlugIns/ProductPageExtension.appex/ProductPageExtension/Applications/AppStore.app/PlugIns/SubscribePageExtension.appex/SubscribePageExtension/Applications/BusinessExtensionsWrapper.app/PlugIns/Business.appex/Business/Applications/Diagnostics.app/Diagnostics/Applications/FindMy.app/FindMy/Applications/FindMy.app/PlugIns/FindMyNotificationsContent.appex/FindMyNotificationsContent/Applications/FindMy.app/PlugIns/FindMyNotificationsService.appex/FindMyNotificationsService/Applications/FindMy.app/PlugIns/FindMySiriIntents.appex/FindMySiriIntents/Applications/FTMInternal-4.app/FTMInternal-4/Applications/GameCenterUIService.app/PlugIns/GameCenterMessageExtension.appex/GameCenterMessageExtension/Applications/Health.app/Health/Applications/HealthENBuddy.app/HealthENBuddy/Applications/HealthENLauncher.app/HealthENLauncher/Applications/InCallService.app/InCallService/Applications/Magnifier.app/Magnifier/Applications/MobilePhone.app/MobilePhone/Applications/MobileSlideShow.app/PlugIns/PhotosReliveWidget.appex/PhotosReliveWidget/Applications/MobileTimer.app/PlugIns/WorldClockWidget.appex/WorldClockWidget/Applications/SharingViewService.app/SharingViewService/Applications/Sidecar.app/PlugIns/ContinuityCamera.appex/ContinuityCamera/Applications/Sidecar.app/PlugIns/ContinuityDisplay.appex/ContinuityDisplay/Applications/Sidecar.app/PlugIns/ContinuityMarkup.appex/ContinuityMarkup/Applications/Sidecar.app/PlugIns/ContinuitySignature.appex/ContinuitySignature/Applications/Sidecar.app/PlugIns/ContinuitySketch.appex/ContinuitySketch/Applications/Sidecar.app/Sidecar/Applications/SleepLockScreen.app/SleepLockScreen/private/var/staged_system_apps/AppleTV.app/PlugIns/TVWidgetExtension.appex/TVWidgetExtension/private/var/staged_system_apps/Books.app/Books/private/var/staged_system_apps/Books.app/Frameworks/BookCore.framework/BookCore/private/var/staged_system_apps/Books.app/Frameworks/JSApp.framework/JSApp/private/var/staged_system_apps/Calculator.app/Calculator/private/var/staged_system_apps/Files.app/Files/private/var/staged_system_apps/Fitness.app/Fitness/private/var/staged_system_apps/Fitness.app/PlugIns/FitnessWidget.appex/FitnessWidget/private/var/staged_system_apps/Maps.app/PlugIns/GeneralMapsWidget.appex/GeneralMapsWidget/private/var/staged_system_apps/Measure.app/Measure/private/var/staged_system_apps/MobileCal.app/PlugIns/CalendarWidgetExtension.appex/CalendarWidgetExtension/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/MobileNotes.app/PlugIns/com.apple.mobilenotes.WidgetExtension.appex/com.apple.mobilenotes.WidgetExtension/private/var/staged_system_apps/Music.app/Frameworks/MusicApplication.framework/MusicApplication/private/var/staged_system_apps/Music.app/Frameworks/MusicApplication.framework/XPCServices/MusicScriptUpdateService.xpc/MusicScriptUpdateService/private/var/staged_system_apps/Music.app/Music/private/var/staged_system_apps/Music.app/PlugIns/MediaPicker.appex/MediaPicker/private/var/staged_system_apps/Music.app/PlugIns/MusicMessagesApp.appex/MusicMessagesApp/private/var/staged_system_apps/Music.app/PlugIns/MusicNotificationContentExtension.appex/MusicNotificationContentExtension/private/var/staged_system_apps/Music.app/PlugIns/MusicWidgets.appex/MusicWidgets/private/var/staged_system_apps/Music.app/PlugIns/PlaybackIntent.appex/PlaybackIntent/private/var/staged_system_apps/News.app/PlugIns/NewsAudioExtension.appex/NewsAudioExtension/private/var/staged_system_apps/News.app/PlugIns/NewsTag.appex/NewsTag/private/var/staged_system_apps/News.app/PlugIns/NewsToday2.appex/NewsToday2/private/var/staged_system_apps/News.app/PlugIns/NewsTodayIntents.appex/NewsTodayIntents/private/var/staged_system_apps/Podcasts.app/Frameworks/AppStoreKit.framework/AppStoreKit/private/var/staged_system_apps/Podcasts.app/Frameworks/NowPlayingUI.framework/NowPlayingUI/private/var/staged_system_apps/Podcasts.app/Frameworks/PodcastsStoreUI.framework/PodcastsStoreUI/private/var/staged_system_apps/Podcasts.app/PlugIns/PodcastsClassKitExtension.appex/PodcastsClassKitExtension/private/var/staged_system_apps/Podcasts.app/PlugIns/PodcastsWidget.appex/PodcastsWidget/private/var/staged_system_apps/Podcasts.app/Podcasts/private/var/staged_system_apps/Reminders.app/PlugIns/RemindersIntentsExtension.appex/RemindersIntentsExtension/private/var/staged_system_apps/Reminders.app/PlugIns/RemindersIntentsUIExtension.appex/RemindersIntentsUIExtension/private/var/staged_system_apps/Reminders.app/PlugIns/RemindersSharingExtension.appex/RemindersSharingExtension/private/var/staged_system_apps/Reminders.app/PlugIns/RemindersSpotlightIndexExtension.appex/RemindersSpotlightIndexExtension/private/var/staged_system_apps/Reminders.app/PlugIns/RemindersWidgetExtension.appex/RemindersWidgetExtension/private/var/staged_system_apps/Reminders.app/Reminders/private/var/staged_system_apps/SequoiaTranslator.app/PlugIns/CacheDeleteExtension.appex/CacheDeleteExtension/private/var/staged_system_apps/SequoiaTranslator.app/SequoiaTranslator/private/var/staged_system_apps/Shortcuts.app/Shortcuts/private/var/staged_system_apps/Stocks.app/PlugIns/StocksDetailIntents.appex/StocksDetailIntents/private/var/staged_system_apps/Stocks.app/PlugIns/StocksWidget.appex/StocksWidget/private/var/staged_system_apps/Stocks.app/Stocks/private/var/staged_system_apps/Tips.app/PlugIns/TipsSwift.appex/TipsSwift/private/var/staged_system_apps/Weather.app/PlugIns/WeatherWidget.appex/WeatherWidget[...]


检测使用了SwiftUI的二进制文件


于2019年的全球开发者大会上发布的 SwiftUI 是一个全新的框架,可以使用 Swift 构建用户界面。这样,使用 SwiftUI 生成的二进制文件就会使用 Swift我们能不能列出所有使用了 SwiftUI 的应用程序?

我曾经开发过一个发 iOS 14的小部件 Clatters 3.0,我注意到这些小部件链接到了

/System/Library/Frameworks/SwiftUI.framework/Versions/A/SwiftUI

只需稍微调整一下,检测 Swift 的脚本就可以转变为检测 SwiftUI:

otool -L $1 2>/dev/null | grep -o /System/Library/Frameworks/SwiftUI.framework/SwiftUI | wc -l


iOS13.7中SwiftUI的使用情况


到目前为止,我还没有发布 iOS 中 SwiftUI 的应用程序列表。作为参考,我建立了如下iOS 13.7的列表。毫不奇怪,iOS 13.7仅包含少量依赖SwiftUI的二进制文件:

/Applications/SharingViewService.app/SharingViewService/System/Library/Frameworks/SwiftUI.framework/SwiftUI/System/Library/PrivateFrameworks/Settings/LegalAndRegulatorySettingsPrivate.framework/LegalAndRegulatorySettingsPrivate/System/Library/PrivateFrameworks/Settings/SettingsUIKitPrivate.framework/SettingsUIKitPrivate/System/Library/PrivateFrameworks/Settings/WallpaperSettings.framework/WallpaperSettings/System/Library/PrivateFrameworks/VideosUI.framework/VideosUI


iOS14.0中SwiftUI的使用情况


iOS14.0包含更多使用了SwiftUI二进制文件。主要原因无疑是WidgetKit的推出,这是第一个公共的SwiftUI专用框架。iOS 14中的每个小部件都出现在该列表中。iOS 14的另一个闪亮的新功能是Translate应用程序,它似乎也是用SwiftUI构建的。

/Applications/MobilePhone.app/MobilePhone/Applications/MobileSlideShow.app/PlugIns/PhotosReliveWidget.appex/PhotosReliveWidget/Applications/MobileTimer.app/PlugIns/WorldClockWidget.appex/WorldClockWidget/Applications/SharingViewService.app/SharingViewService/Applications/SleepLockScreen.app/SleepLockScreen/private/var/staged_system_apps/AppleTV.app/PlugIns/TVWidgetExtension.appex/TVWidgetExtension/private/var/staged_system_apps/Fitness.app/PlugIns/FitnessWidget.appex/FitnessWidget/private/var/staged_system_apps/Maps.app/PlugIns/GeneralMapsWidget.appex/GeneralMapsWidget/private/var/staged_system_apps/MobileCal.app/PlugIns/CalendarWidgetExtension.appex/CalendarWidgetExtension/private/var/staged_system_apps/MobileNotes.app/PlugIns/com.apple.mobilenotes.WidgetExtension.appex/com.apple.mobilenotes.WidgetExtension/private/var/staged_system_apps/Music.app/PlugIns/MusicWidgets.appex/MusicWidgets/private/var/staged_system_apps/News.app/PlugIns/NewsTag.appex/NewsTag/private/var/staged_system_apps/News.app/PlugIns/NewsToday2.appex/NewsToday2/private/var/staged_system_apps/Podcasts.app/PlugIns/PodcastsWidget.appex/PodcastsWidget/private/var/staged_system_apps/Reminders.app/PlugIns/RemindersWidgetExtension.appex/RemindersWidgetExtension/private/var/staged_system_apps/SequoiaTranslator.app/SequoiaTranslator/private/var/staged_system_apps/Shortcuts.app/Shortcuts/private/var/staged_system_apps/Stocks.app/PlugIns/StocksWidget.appex/StocksWidget/private/var/staged_system_apps/Tips.app/PlugIns/TipsSwift.appex/TipsSwift/private/var/staged_system_apps/Weather.app/PlugIns/WeatherWidget.appex/WeatherWidget/System/Library/Frameworks/_AuthenticationServices_SwiftUI.framework/_AuthenticationServices_SwiftUI/System/Library/Frameworks/_AVKit_SwiftUI.framework/_AVKit_SwiftUI/System/Library/Frameworks/_HomeKit_SwiftUI.framework/_HomeKit_SwiftUI/System/Library/Frameworks/_MapKit_SwiftUI.framework/_MapKit_SwiftUI/System/Library/Frameworks/_QuickLook_SwiftUI.framework/_QuickLook_SwiftUI/System/Library/Frameworks/_SceneKit_SwiftUI.framework/_SceneKit_SwiftUI/System/Library/Frameworks/_SpriteKit_SwiftUI.framework/_SpriteKit_SwiftUI/System/Library/Frameworks/_StoreKit_SwiftUI.framework/_StoreKit_SwiftUI/System/Library/Frameworks/SwiftUI.framework/SwiftUI/System/Library/Frameworks/UIKit.framework/PlugIns/com.apple.UIKit.ColorPicker.appex/com.apple.UIKit.ColorPicker/System/Library/Frameworks/WidgetKit.framework/WidgetKit/System/Library/PrivateFrameworks/CalendarWidget.framework/CalendarWidget/System/Library/PrivateFrameworks/ChronoCore.framework/ChronoCore/System/Library/PrivateFrameworks/ChronoCore.framework/Support/chronod/System/Library/PrivateFrameworks/ChronoKit.framework/ChronoKit/System/Library/PrivateFrameworks/ComplicationDisplay.framework/ComplicationDisplay/System/Library/PrivateFrameworks/GameCenterUI.framework/GameCenterUI/System/Library/PrivateFrameworks/GameCenterUI.framework/PlugIns/GameCenterDashboardExtension.appex/GameCenterDashboardExtension/System/Library/PrivateFrameworks/PhotosUIApps.framework/PhotosUIApps/System/Library/PrivateFrameworks/Settings/LegalAndRegulatorySettingsPrivate.framework/LegalAndRegulatorySettingsPrivate/System/Library/PrivateFrameworks/Settings/SettingsUIKitPrivate.framework/SettingsUIKitPrivate/System/Library/PrivateFrameworks/Settings/WallpaperSettings.framework/WallpaperSettings/System/Library/PrivateFrameworks/WorkflowEditor.framework/WorkflowEditor/System/Library/PrivateFrameworks/WorkflowUICore.framework/WorkflowUICore


总结


iOS14中的新功能都是使用Swift代码构建的,这一点也不足为奇。iOS 14最明显的功能之一就是主屏幕上添加了很多小部件。而这些小部件都是使用SwiftUI有且仅有的第一个框架WidgetKit构建的。这就说明了为什么今年SwiftUI的采用增长如此之快。iOS 14的另一个重要新功能是Translate应用,它似乎也是用SwiftUI构建的。

除了Swift库之外,iOS 14.0中总共包含291个使用了Swift的二进制文件,是iOS13的两倍。另外值得注意的是,SwiftUI已被iOS 14中的43个二进制文件迅速采用。

原文:https://blog.timac.org/2020/0927-state-of-swift-ios14/

本文为 CSDN 翻译,转载请注明来源出处。

更多精彩推荐

300亿美元,AMD为什么要买Xilinx?

“我们的边缘计算技术点,可能超前了业界一点”1024程序员节开源技术英雄会,参会“英雄榜”发榜

5行Python代码实现刷爆全网的动态条形图!

如何应对云原生之旅中的安全挑战?

区块链+生鲜:杜绝“偷梁换柱”和“以次充好”
点分享点点赞点在看

    您可能也对以下帖子感兴趣

    文章有问题?点此查看未经处理的缓存