Adding Swift to project increase size substantiously. How and when can it be avoided
I have a small app written in Objective-C. It was something like 3 Mb of size.
When I added one Swift file the size of my archive grew up to 10 Mb.
What i found is that Swift embeds it’s actual library in every project it is used in. This is necessary to be able to run the project even in case that Swift library changes in the future.
But 8 Megabytes is a huge overhead for small projects. Maybe there is some information about when Swift will get stable library that will be embedded in OS?
Or maybe there are some flags that can be added to the project that force compiler to use standard Swift library embedded in iOS?
- swift: async task + completion
- Using UDID to create unique user identity
- Google plus API for posting on wall like Facebook
- iOS 6: Parent modal's modalPresentationStyle ignored after rotation
- UICollectionView 3 column grid, 1px space?? (image included)
- NSUserDefaultsDidChangeNotification and Today Extensions
Solutions Collect From Internet About “Adding Swift to project increase size substantiously. How and when can it be avoided”
Swift is still changing. So at the moment the runtime has to be included with every app. Maybe Apple will include the Swift runtime in iOS once the development of Swift slows down.
Swift source code had to be adjusted after almost every release of Xcode since the 6.0 betas. The runtime has changed at the same time the compiler has. iOS can’t use a standard swift library, but has to use the one the app was compiled and linked with.
See this explanation by Apple.
you can trust that your app will work well into the future. In fact, you can target back to OS X Mavericks or iOS 7 with that same app. This is possible because Xcode embeds a small Swift runtime library within your app’s bundle. Because the library is embedded, your app uses a consistent version of Swift that runs on past, present, and future OS releases
While your app’s runtime compatibility is ensured, the Swift language itself will continue to evolve, and the binary interface will also change.
As Swift changes, those frameworks will be incompatible with the rest of your app. When the binary interface stabilizes in a year or two, the Swift runtime will become part of the host OS and this limitation will no longer exist
Not using Swift is the only way to keep your app size down.
Since Swift 3.0 won’t deliver a stable ABI, this will remain the same for the time being. So in a year or two probably translates to Swift 5.0 in 2018.
- Difference between NSCalendarUnitWeekOfYear & NSCalendarUnitWeekOfMonth
- How to make loop wait until block has finished?
- Alcatraz in XCode 7.1
- Hide keyboard when scroll UITableView
- Deploy from XCode 4.6.2 to iOS 7 (beta) device
- Cannot run swift project on phone. dyld: Library not loaded: @rpath/libswiftCore.dylib
- Memory profiling doesn't work with Xcode 9
- How to check an array of 'Any' type if it is empty or not?
- IOS: create a UIImage or UIImageView with rounded corners
- Masking First and Last Name String with *
- String won't url encode in iOS
- Animating with UIDynamicAnimator when Autolayout is in play
- core-plot iOS reversed Y axis
- ionic emulate ios (domain=com.apple.CoreSimulator.SimError, code=163)
- How to write this code in swift?