sberrevoets / SDCAlertView

The little alert that could
MIT License
1.86k stars 297 forks source link

SPM support #295

Closed florentmorin closed 3 years ago

florentmorin commented 5 years ago

Did you plan to support Swift Package Manager integrated into Xcode 11?

sberrevoets commented 5 years ago

I haven’t looked yet at what’s needed to make the library compatible with the major platform updates, also for compatibility with dark mode and iPad apps on the Mac.

At least one problem right now is that SPM doesn’t support resources so there’s more work involved than just “enabling” support. Will try to look as this soon.

BarryHaanstra commented 4 years ago

Dark mode support would be really appreciated!

Currently I kind of hacked it together with the following code in AlertView.swifts createBackground method:

        var style: UIBlurEffect.Style = .extraLight
        if #available(iOS 13, *) {
            if self.traitCollection.userInterfaceStyle == .dark {
                style = .dark
            }
        }

        let backgroundView = UIVisualEffectView(effect: UIBlurEffect(style: style))

Probably a bit too basic :)

sberrevoets commented 4 years ago

Realistically I think that's probably the only way to implement this. I have a hunch that Apple is using custom effects to implement their alert backgrounds but reverse engineering that isn't really worth anyone's time.

smamczak commented 4 years ago

any news about SPM support?

sberrevoets commented 4 years ago

No updates. I think the xibs in this project would need to be converted to code first but I have no concrete plans for doing so. Feel free to submit a PR though!

smamczak commented 4 years ago

You are probably right, but in new Swift 5.3 SPM will support bundles, so maybe there will be a option to load xibs from resources. They should publish it in June I think

https://github.com/apple/swift-evolution/blob/master/proposals/0271-package-manager-resources.md

lechuckcaptain commented 4 years ago

Feel free to submit a PR though!

I'll give it a try!