JFLib

plat/apple_ios_share.rs (Apple)#

Source: lib/plat/apple_ios_share.rs

apple_ios_share -- (share.rs) iOS's share sheet: UIActivityViewController over the scene's window

  share(&Share) -> SHARE_PENDING / SHARE_NONE   the sheet, presented by the topmost controller (as
                               the file picker); on an iPad a popover at the anchor (points = px over
                               the canvas's scale), without one in the view's middle and without an
                               arrow.  SHARE_NONE without UIKit's host or off the main thread.
  available() -> bool          (any thread) UIKit's host runs the app
  ios_share_shown() / ios_share_dismiss()   (tests) the sheet on screen, closed again

Items: the text (NSString), the link (NSURL), the files (file URLs).  A title goes in as the
subject (Mail's subject line) through an item source (JFShareItem) wrapping the first item.  The
completion handler (a global block: one sheet at a time) answers SHARE_DONE when an activity
completed, SHARE_FAILED with an error, SHARE_CANCELLED otherwise (the sheet or the activity closed).
  • fn ios_share_shown() -> Option<String> (tests, any thread) the class of the controller presented over the window now (the share sheet: "UIActivityViewController"), None when nothing is presented or without the host

  • fn ios_share_dismiss() -> bool (tests, any thread) the presented sheet closed as its Close button does: the controller's completion handler with nothing chosen (UIKit calls it for the user's Close, not for a dismissal by code), then the dismissal -> false when none

Source: docs/API.md in the JFLib repository.