为何 iOS 越来越偏爱 Swift?
【CSDN编者按】本月初,苹果已经面向所有iPhone用户,推送了iOS 12.0.1正式版。那么,iOS 12.0中Swift的应用是个什么样子?iOS中使用Swift的二进制文件数目又有怎样的变化?一起来看今天的文章!
两年前我评估了苹果在iOS 10.1中Swift的应用情况,去年我评估了iOS 11.1中的应用情况。
今年我来分析苹果这个月刚刚发布的iOS 12。
1.方法
本文使用的方法和工具在前面的文章里说过了。有兴趣的话可以参考这篇文章:苹果在iOS 10.1和macOS 10.12中对Swift的应用情况(https://blog.timac.org/2016/1101-apples-use-of-swift-in-ios-10-1-and-macos-10-12/)。
2.iOS 12.0中Swift的应用
下面是iOS 12.0中所有使用Swift的二进制文件。注意这些二进制文件可能只包含一行Swift代码,并不一定完全是用Swift写成的。我测试的是iPhone X中的iOS 12.0(16A366)。
/Applications/ActivityMessagesApp.app/PlugIns/ActivityMessagesExtension.appex/ActivityMessagesExtension /Applications/AppStore.app/AppStore /Applications/AppStore.app/Frameworks/AppStoreKit.framework/AppStoreKit /Applications/AppStore.app/Frameworks/JetEngine.framework/JetEngine /Applications/AppStore.app/PlugIns/AppInstallExtension.appex/AppInstallExtension /Applications/AppStore.app/PlugIns/BridgeStoreExtension.appex/BridgeStoreExtension /Applications/AppStore.app/PlugIns/ProductPageExtension.appex/ProductPageExtension /Applications/BusinessExtensionsWrapper.app/PlugIns/Business.appex/Business /Applications/ContinuityCamera.app/ContinuityCamera /Applications/Diagnostics.app/Diagnostics /Applications/FTMInternal-4.app/FTMInternal-4 /Applications/SharingViewService.app/SharingViewService /private/var/staged_system_apps/Books.app/Frameworks/AppAnalytics.framework/AppAnalytics /private/var/staged_system_apps/Calculator.app/Calculator /private/var/staged_system_apps/Files.app/Files /private/var/staged_system_apps/Files.app/PlugIns/RecentsWidget.appex/RecentsWidget /private/var/staged_system_apps/Measure.app/Measure /private/var/staged_system_apps/Music.app/Music /private/var/staged_system_apps/Music.app/PlugIns/MusicMessagesApp.appex/MusicMessagesApp /private/var/staged_system_apps/Music.app/PlugIns/PlaybackIntent.appex/PlaybackIntent /private/var/staged_system_apps/Music.app/PlugIns/RecentlyPlayedTodayExtension.appex/RecentlyPlayedTodayExtension /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/PodcastsUI.framework/PodcastsUI /private/var/staged_system_apps/Podcasts.app/Podcasts /private/var/staged_system_apps/Stocks.app/PlugIns/StocksToday.appex/StocksToday /private/var/staged_system_apps/Stocks.app/Stocks /System/Library/Accounts/DataclassOwners/StocksDataclassOwner.bundle/StocksDataclassOwner /System/Library/Accounts/Notification/DonationAccountWatcher.bundle/DonationAccountWatcher /System/Library/DistributedEvaluation/Plugins/StocksDES.desPlugin/StocksDES /System/Library/Frameworks/FileProvider.framework/PlugIns/LocalStorageFileProvider.appex/LocalStorageFileProvider /System/Library/Frameworks/IdentityLookup.framework/XPCServices/com.apple.IdentityLookup.MessageFilter.xpc/com.apple.IdentityLookup.MessageFilter /System/Library/Messages/iMessageBalloons/ASMessagesProvider.bundle/ASMessagesProvider /System/Library/PrivateFrameworks/ContactsDonation.framework/Versions/A/Support/contactsdonationagent /System/Library/PrivateFrameworks/CoreParsec.framework/parsec-fbf /System/Library/PrivateFrameworks/CoreParsec.framework/parsecd /System/Library/PrivateFrameworks/DocumentManagerUICore.framework/PlugIns/com.apple.DocumentManager.Service.appex/com.apple.DocumentManager.Service /System/Library/PrivateFrameworks/DocumentManagerUICore.framework/PlugIns/RecentsAppPopover.appex/RecentsAppPopover /System/Library/PrivateFrameworks/FMClient.framework/XPCServices/FMIPClientXPCService.xpc/FMIPClientXPCService /System/Library/PrivateFrameworks/Swift/libswiftDemangle.dylib /System/Library/PrivateFrameworks/Swift/libswiftXCTest.dylib /System/Library/PrivateFrameworks/TelephonyUtilities.framework/callservicesd /System/Library/PrivateFrameworks/TelephonyUtilities.framework/PlugIns/PhoneIntentHandler.appex/PhoneIntentHandler /System/Library/PrivateFrameworks/UpNextWidget.framework/PlugIns/UpNext.appex/UpNext /usr/libexec/sharingd /usr/libexec/SidecarRelay /usr/libexec/tzd
共享的dyld缓存还包含以下的二进制文件,大多数是Swift的库:
/System/Library/PrivateFrameworks/ConversationKit.framework/ConversationKit /System/Library/PrivateFrameworks/CoreKnowledge.framework/CoreKnowledge /System/Library/PrivateFrameworks/FMClient.framework/FMClient /System/Library/PrivateFrameworks/News/Tea.framework/Tea /System/Library/PrivateFrameworks/News/TeaActivities.framework/TeaActivities /System/Library/PrivateFrameworks/News/TeaFoundation.framework/TeaFoundation /System/Library/PrivateFrameworks/News/TeaSettings.framework/TeaSettings /System/Library/PrivateFrameworks/News/TeaUI.framework/TeaUI /System/Library/PrivateFrameworks/Stocks/AppAnalytics.framework/AppAnalytics /System/Library/PrivateFrameworks/Stocks/NewsArticles.framework/NewsArticles /System/Library/PrivateFrameworks/Stocks/NewsFeed.framework/NewsFeed /System/Library/PrivateFrameworks/Stocks/StocksAnalytics.framework/StocksAnalytics /System/Library/PrivateFrameworks/Stocks/StocksCore.framework/StocksCore /System/Library/PrivateFrameworks/Stocks/StocksUI.framework/StocksUI /System/Library/PrivateFrameworks/Stocks/TeaActivities.framework/TeaActivities /System/Library/PrivateFrameworks/Stocks/TeaCharts.framework/TeaCharts /System/Library/PrivateFrameworks/Stocks/TeaDB.framework/TeaDB /System/Library/PrivateFrameworks/Stocks/TeaFoundation.framework/TeaFoundation /System/Library/PrivateFrameworks/Stocks/TeaSettings.framework/TeaSettings /System/Library/PrivateFrameworks/Stocks/TeaTemplate.framework/TeaTemplate /System/Library/PrivateFrameworks/Stocks/TeaUI.framework/TeaUI /System/Library/PrivateFrameworks/Swift/libswiftAccelerate.dylib /System/Library/PrivateFrameworks/Swift/libswiftARKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftAssetsLibrary.dylib /System/Library/PrivateFrameworks/Swift/libswiftAVFoundation.dylib /System/Library/PrivateFrameworks/Swift/libswiftCallKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftCloudKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftContacts.dylib /System/Library/PrivateFrameworks/Swift/libswiftCore.dylib /System/Library/PrivateFrameworks/Swift/libswiftCoreAudio.dylib /System/Library/PrivateFrameworks/Swift/libswiftCoreData.dylib /System/Library/PrivateFrameworks/Swift/libswiftCoreFoundation.dylib /System/Library/PrivateFrameworks/Swift/libswiftCoreGraphics.dylib /System/Library/PrivateFrameworks/Swift/libswiftCoreImage.dylib /System/Library/PrivateFrameworks/Swift/libswiftCoreLocation.dylib /System/Library/PrivateFrameworks/Swift/libswiftCoreMedia.dylib /System/Library/PrivateFrameworks/Swift/libswiftDarwin.dylib /System/Library/PrivateFrameworks/Swift/libswiftDispatch.dylib /System/Library/PrivateFrameworks/Swift/libswiftFoundation.dylib /System/Library/PrivateFrameworks/Swift/libswiftGameplayKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftGLKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftHomeKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftIntents.dylib /System/Library/PrivateFrameworks/Swift/libswiftMapKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftMediaPlayer.dylib /System/Library/PrivateFrameworks/Swift/libswiftMetal.dylib /System/Library/PrivateFrameworks/Swift/libswiftMetalKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftModelIO.dylib /System/Library/PrivateFrameworks/Swift/libswiftNaturalLanguage.dylib /System/Library/PrivateFrameworks/Swift/libswiftNetwork.dylib /System/Library/PrivateFrameworks/Swift/libswiftObjectiveC.dylib /System/Library/PrivateFrameworks/Swift/libswiftos.dylib /System/Library/PrivateFrameworks/Swift/libswiftPhotos.dylib /System/Library/PrivateFrameworks/Swift/libswiftQuartzCore.dylib /System/Library/PrivateFrameworks/Swift/libswiftSceneKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftsimd.dylib /System/Library/PrivateFrameworks/Swift/libswiftSpriteKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftSwiftOnoneSupport.dylib /System/Library/PrivateFrameworks/Swift/libswiftUIKit.dylib /System/Library/PrivateFrameworks/Swift/libswiftVision.dylib /System/Library/PrivateFrameworks/Swift/libswiftWatchKit.dylib
3.结论
苹果在iOS 12中添加了一些新功能,预料之中的是,这些应用都会包含一些Swift代码。比如Continuity Camera和Measure应用就是如此。
以前的应用被更新过,一些也包含了更多的Swift代码,如AppStore、Books、Music、News、SharingViewService和Stocks。
可以看到,每次新的iOS发布,苹果都在越来越多的应用中使用Swift,但这些应用的总数依然很有限。下面这张图显示了iOS中使用Swift的二进制文件数目的增长(不含Swift库):
原文:https://blog.timac.org/2018/0924-state-of-swift-ios12/
译者:弯月,责编:胡巍巍