I've recreated a simple app that was originally made in React Native with 5MB file size on the app store. The app has no images or anything of any particular size, but it does use Admob
ads.
After uploading it to the app store the build is showing as 35MB...not sure what the reason is but it when opening the package contents of the build archive it seems that a bunch of dylib
files in SwiftSupport/iphoneos
are created that are very large. that's the biggest folder in the archive anyway. I think it has to do with the Pods
folder created in order to use Admob.
I'm guessing it can never be as small as the React Native original app but surely it should not be seven times the size...is there some way to remove the SwiftSupport
files or another way to shrink it?
EDIT: Also in the Runner project folder in the build archive in Frameworks
there are loads of Swift dylib
files in there too that are large. Really all the space is being taken up by these Swift support dylib
files...
Just built the app for Android and it's 8.33MB so quite a difference there, even though both versions of course use Admob.
I have two sources: first [1] is titled 'Flutter vs Swift' and second [2] 'How to enable swift support for existing project in flutter'. Reading the both we observe flutter and swift do not have to co-exist and observing the latter we can see how it is enabled with a flag when creating the IOS package. I would first check that IOS folder is created without swift reference.
Third link [3] shows that Admob usage can be done in dart only.
About size, I am not sure though if using dart and disabling Swift would 100% make the trick. Flutter vs Swift link [1] has a native Swift app and 'comparison' equal Flutter app and conclusion was the size of flutter app was doubled about that of Swift app. And sizes where around 20 and 50 MB respectively, Flutter being the biggest.
Edit
It shows up the Swift is part of the plugin / module you use and thus cannot be easily just removed. About the size, Flutter app is normally already bigger than app with Swift and now the solution combines the both. Rise in size is as espected.
[1] https://blog.codemagic.io/flutter-vs-swift/
[2] How to enable Swift support for existing project in flutter
[3] https://flutterawesome.com/easily-implement-ads-into-a-flutter-app/
This isn't really related to Flutter. Every iOS app containing code that wants to support iOS 11 and lower, needs to contain additional flutter libraries.
You can disable this in Xcode by setting "Always Embed Swift Standard Libraries" to false, and raising the deployment target to iOS 12.