alexmercerind / flutter_acrylic

Flutter library for window acrylic, mica & transparency effects.
MIT License
595 stars 53 forks source link

Error with `Window.addToolbar()` #45

Closed damywise closed 1 year ago

damywise commented 1 year ago

When building the app that has the code Window.addToolbar() in it, it fails to build with the following message:

/Users/USR1132/flutter/.pub-cache/git/flutter_acrylic-49776d5078b2c482e552fa090a8db948c66b3ec6/macos/Classes/MainFlutterWindowManipulator.swift:391:26: error: 'init()' is only available in macOS 10.13 or newer
        let newToolbar = NSToolbar()
                         ^
        let newToolbar = NSToolbar()
                         ^
    public static func addToolbar() {
                       ^
public class MainFlutterWindowManipulator {

This can be fixed by wrapping the code within addToolbar() function with this:

if #available(macOS 10.13, *) {
    //...
}
Adrian-Samoticha commented 1 year ago

This is interesting since I don't get this error when compiling the example project. Before I merge your pull request, what is your project's deployment target?

damywise commented 1 year ago

10.11, yeah it's lower than the minimum.

Adrian-Samoticha commented 1 year ago

Yeah, Xcode won't even let me go below 10.13 in the example project anymore (I guess I should update the readme, then), though I guess merging your PR won't hurt.