louisdh/openterm

Addding commands that have UI components

JayantVarma opened this issue · 2 comments

This is related to issue #108

How can one create a command that uses a UIViewController to do something and then return the data as terminal text.

  • semaphore to wait for the execution to finish
  • DispatchMain to display a ViewController
  • synchronised return values from the function???
  • display text asynchronously? Like in a loop but with a delay.

OpenTerm crashes if I try to run a URLSession command and fputs on receiving the data.

I am even trying simple code like

	let evStore = EKEventStore()
	let reminders:[EKReminder] = []

	DispatchQueue.main.async {
		evStore.requestAccess(to: .reminder) { (granted, error) in
			if granted {
				fputs("You have access to the reminders", thread_stdout)
			} else {
				fputs("You did not have access to the reminders", thread_stderr)
			}
		}
	}

the imports and permission in the plist is already there. Anything that requires an UI element fails.