Migrating Kingfisher from version 6 to version 7.
Kingfisher 7.0 contains some breaking changes if you want to upgrade from the previous version. In this documentation, we will cover most of the noticeable API changes.
The UIKit/AppKit part of Kingfisher now supports from:
We do not have proper simulator support or device of versions before those. So dropping any older versions give us a chance to make sure the project works properly on all supported versions. This also fixes a compiling issue when building with Xcode 13 with SPM.
The SwiftUI part of Kingfisher now supports from
On iOS 13, there is no
@StateObjectproperty wrapper, which makes it very tricky when loading data properly across difference view body evaluating. For a stable data model in Kingfisher's SwiftUI, we need to drop iOS 13 and all other platform versions from the same year.
The main breaking changes happens to the SwiftUI support. By following the steps you should be able to migrate to the new version.
KFImage initializers: init(source:isLoaded:) and init(_:isLoaded:) are removed. Or strictly speaking, the isLoaded parameter is removed. If you are not using the isLoaded binding before, the transition to the new initializer KFImage/init(source:) and KFImage/init(_:) is transparent.
isLoaded binding was a mis-use of binding and it did not do what is expected. If you need to get a state of loading of a KFImage, change a @State yourself in the related KFImage lifecycle modifier: such as KFImage/onSuccess(_:) and KFImage/onFailure(_:).isLoaded parameter are also removed from the chain-able KF shorthand.KFImage/loadImmediately(_:) to get workaround of #1660, it is not necessary in the new version anymore. You will have a warning and please just remove it.