Documentation
¶
Overview ¶
Package ios is the platform of iOS (SPEC §30): UIKit through purego's objc (SPEC §29.2, the helpers of internal/platform/darwin) and, in the *_ios.go files only, the few lines of cgo that Go's iOS port needs (D35: the port links externally and purego needs cgo there, so the files that name the frameworks to link carry `import "C"`; nothing else is in C).
Step 35.1 has the entry: Main calls UIApplicationMain on the main thread with a delegate class and a scene delegate class that Go implements, and calls back when the app has launched and a scene has connected. Step 35.2 has the platform: New, Run, Post, the scene and its windows (a GlutterView in a view controller in a UIWindow), the frames of a CADisplayLink, the metrics with the safe area, rotation and the lifecycle. The input and the rest come with the later steps of M35. On every other operating system the package has Main too, which fails with IOSUnavailable, so that a program that calls it builds everywhere.
Flutter: shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm FlutterAppDelegate
Index ¶
Constants ¶
const ( A11yElementsLogLine = "ios a11y elements" A11yElementLogLine = "ios a11y element" A11yActivateLogLine = "ios a11y activate" )
A11yLogLines are the messages of the lines that the dev events steps "a11y" and "a11y-activate" log.
Flutter: no counterpart
const ( // TagIOSNotMainThread is the tag of the error of a call that UIKit allows on the main thread only, made on another thread. // // Flutter: no counterpart TagIOSNotMainThread = "IOSNotMainThread" // // Flutter: no counterpart TagIOSUnavailable = "IOSUnavailable" )
const ChromeLogLine = "ios chrome"
ChromeLogLine is the message of the line that the dev events step "chrome" logs.
Flutter: no counterpart
const DevEventsEnv = "GLUTTER_DEV_EVENTS"
DevEventsEnv is the environment variable with the script of synthetic touches and keys that debug builds replay after the first frame, so that a proof screenshot or a Simulator test can show an app after a tap, a drag or a key: the headless Simulator has no way to send a touch. The events go through the same conversion as the real ones (SPEC §30.4). It is read only in debug builds (foundation.DebugMode).
Flutter: no counterpart
const OrientationAll = OrientationPortrait | OrientationPortraitUpsideDown | OrientationLandscape
OrientationAll is every interface orientation (UIInterfaceOrientationMaskAll).
Flutter: no counterpart
const TagIOSDevEventsInvalid = "IOSDevEventsInvalid"
TagIOSDevEventsInvalid is the tag of the error of a GLUTTER_DEV_EVENTS script that cannot be read.
Flutter: no counterpart
Variables ¶
This section is empty.
Functions ¶
func Main ¶
func Main(MainOptions) error
Main fails with IOSUnavailable: this build is not for iOS.
Flutter: no counterpart
Types ¶
type DevEvent ¶
type DevEvent struct {
// Kind is the name of the step: "wait", "tap", "drag", "key", "text", "compose", "composing", "keyboard", "keyboardhide", "chrome", "a11y" or "a11y-activate".
Kind string
// Wait is how long to wait, for "wait", and how long a "drag" takes.
Wait time.Duration
// Text is the text of a "text" step, and Steps are the pieces of a "compose" or "composing" step, each the marked text of an update of
// the input method.
Text string
Steps []string
// Height is the height in points of the keyboard of a "keyboard" step.
Height float64
// X, Y are the place of a "tap" and the start of a "drag", in points from the top left of the view; X2, Y2 are the end of a "drag".
X, Y, X2, Y2 float64
// Key is the physical key of a "key" step, in Flutter's names (KeyA, Digit1, Enter, ArrowLeft), and Mods the modifiers that are down while
// it is pressed, a "+"-joined subset of shift, control, alt and meta.
Key, Mods string
}
DevEvent is one step of a dev events script.
Flutter: no counterpart
func ParseDevEvents ¶
ParseDevEvents reads a dev events script: steps separated by ";", each "name:arguments".
wait:500ms waits
tap:x,y touches the place (points from the top left of the view) and lifts the finger
drag:x,y,x2,y2[,d] puts a finger at the first place, moves it to the second in steps of 16 ms over the duration d (200ms when it is
left out) and lifts it
text:Hello types the text as a keyboard does that composes nothing: one insertText: for each character (the blanks are
typed; the control characters type nothing; no ";")
compose:a,b,c an input method composes a, then b, then c (setMarkedText: each), commits c (insertText:) and ends the composition
composing:a,b,c the same, but the composition stays (a later compose: goes on with it)
keyboard:h the soft keyboard comes up, h points high (UIKit's frame notification, with a keyboard's duration)
keyboardhide the soft keyboard goes down
a11y logs the accessibility elements of the first window as UIKit has them: the line "ios a11y elements" with their
number and a line "ios a11y element" for each, with its label, value, hint, traits and frame
a11y-activate:label activates the element whose label is the text, as VoiceOver's double tap does (accessibilityActivate), and logs the
line "ios a11y activate" with the answer
chrome logs what UIKit has of the system UI of the window (the status bar's style and visibility, the home indicator,
the supported orientations), as the line "ios chrome"
key:Name[,mods] presses and releases a key of a hardware keyboard with the modifiers (shift, control, alt, meta, joined by "+")
pressed before it and released after it: key:KeyC,meta is Command+C. The names are Flutter's physical keys:
KeyA to KeyZ, Digit0 to Digit9, Enter, Tab, Space, Backspace, Delete, Escape, ArrowLeft, ArrowRight, ArrowUp,
ArrowDown, Home, End, PageUp, PageDown, and F1 to F12
The text steps need a text field with the focus (the input view is the first responder). A step that is not known, or has the wrong arguments, fails with IOSDevEventsInvalid.
Flutter: no counterpart
type MainOptions ¶
type MainOptions struct {
// DidFinishLaunching is called on the main thread when the app has finished launching
// (application:didFinishLaunchingWithOptions:); nil for nothing.
//
// Flutter: shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm application:didFinishLaunchingWithOptions:
DidFinishLaunching func()
// SceneDidConnect is called on the main thread when the window scene has connected and its window is visible
// (scene:willConnectToSession:options:); nil for nothing.
//
// Flutter: shell/platform/darwin/ios/framework/Source/FlutterSceneDelegate.mm scene:willConnectToSession:options:
SceneDidConnect func()
}
MainOptions are the parameters of Main.
Flutter: no counterpart
type Orientation ¶
type Orientation uint64
Orientation is a set of interface orientations, the bits of UIInterfaceOrientationMask.
Flutter: services/system_chrome.dart DeviceOrientation
const ( // OrientationPortrait is UIInterfaceOrientationMaskPortrait. // // Flutter: services/system_chrome.dart DeviceOrientation.portraitUp OrientationPortrait Orientation = 1 << 1 // OrientationPortraitUpsideDown is UIInterfaceOrientationMaskPortraitUpsideDown. // // Flutter: services/system_chrome.dart DeviceOrientation.portraitDown OrientationPortraitUpsideDown Orientation = 1 << 2 // OrientationLandscapeLeft is UIInterfaceOrientationMaskLandscapeLeft. // // Flutter: services/system_chrome.dart DeviceOrientation.landscapeLeft OrientationLandscapeLeft Orientation = 1 << 4 // OrientationLandscapeRight is UIInterfaceOrientationMaskLandscapeRight. // // Flutter: services/system_chrome.dart DeviceOrientation.landscapeRight OrientationLandscapeRight Orientation = 1 << 3 // OrientationLandscape is both landscape orientations. // // Flutter: no counterpart OrientationLandscape = OrientationLandscapeLeft | OrientationLandscapeRight )
The interface orientations, with UIKit's bits.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package a11y is the plain-Go part of the accessibility bridge of iOS (SPEC §30.7): what a node of the semantics tree is to UIAccessibility: whether it is an element, its label, value and hint, its traits, the actions that VoiceOver can do on it and the scroll directions that VoiceOver sends.
|
Package a11y is the plain-Go part of the accessibility bridge of iOS (SPEC §30.7): what a node of the semantics tree is to UIAccessibility: whether it is an element, its label, value and hint, its traits, the actions that VoiceOver can do on it and the scroll directions that VoiceOver sends. |