Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fastis crashes when added via Swift Package Manager #7

Closed
TrzyGracje opened this issue May 31, 2021 · 1 comment
Closed

Fastis crashes when added via Swift Package Manager #7

TrzyGracje opened this issue May 31, 2021 · 1 comment

Comments

@TrzyGracje
Copy link

If Fastis is added to an application via SPM it crashes after opening the calendar view.

In FastisConfig.CurrentValueView there is a definition of an image:

public var clearButtonImage: UIImage = UIImage(named: "icon_clear")!

This line will crash after opening the calendar view since in UIImage + BundleInit.swift extension, bundle is accessed in an incorrect way. For example, if an application MyApp links Fastis via SPM this extension, this extension will attempt to check if there is an image named "icon_clear" in the MyApp bundle, not in Fastis package.

fileprivate class BundleId {}

extension UIImage {
    
    internal convenience init?(named: String) {
        let podBundle = Bundle(for: BundleId.self)
        self.init(named: named, in: podBundle, compatibleWith: nil)
    }
    
}

After some research I have found that most likely instead of using Bundle(for: BundleId.self), Bundle.module should be used. It is suggested in Apple Documentation and in this StackOverflow post and also in this thread.

@ilia3546
Copy link
Contributor

Hi there! This issue was fixed in the 2.0 version. Please check it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants