1 Reply
      Latest reply on May 31, 2019 6:51 AM by Pendragon
      Pendragon Level 1 Level 1 (0 points)

        Is it possible to simulate the "beginSheetModal" (alert or opensavepanel behaviour) when presenting a view controller from a storyboard "storyboard.instantiateController" with "presentAsSheet" to have a completion closure ?

        • Re: presentAsSheet sim as beginSheetModal with return closure ?
          Pendragon Level 1 Level 1 (0 points)

          All I ended up having to do is set a variable inside the View Controller then the same as any other @escaping closure ...


          var completion: ((NSApplication.ModalResponse) -> Void)? = nil
              func openView(handler: @escaping (NSApplication.ModalResponse) -> Void) {
                  if let open_view = self.storyboard!.instantiateController(withIdentifier: "openView") as? openVC {
                      open_view.completion = handler
              let handler = self.openViewResponse
              self.openView(handler: handler)
              func openViewResponse(response: NSApplication.ModalResponse) {
                  switch response {
                  case .OK: