hdehghan/EasyMenu

Incorrect macOS version

NikcN22 opened this issue · 0 comments

'onChange(of:perform:)' is only available in macOS 11.0 or newer

File EasyMenu.swift

// MARK: Body
  public var body: some View {
      Button {
          withAnimation(.easeInOut(duration: config.animationDuration)) {
              showMenu.toggle()
          }
      } label: {
          label
      }
      .onAppear(perform: {
  #if os(macOS)
          if let screen = NSScreen.main {
              screenWidth = screen.frame.size.width
              screenHeight = screen.frame.size.height
          }
  #else
          screenWidth = UIScreen.main.bounds.size.width
          screenHeight = UIScreen.main.bounds.size.height * 2
  #endif
      })
      .overlay(backgroundOverlay())
      .overlay(menuOverlay())
      .onChange(of: isActive) { newValue in    //// <<--- ERROR
          withAnimation(.easeInOut(duration: config.animationDuration)) {
              showMenu.toggle()
          }
      }
//        .zIndex(Double.infinity)
  }