UIKit Functions

Overview

The UIKit framework defines a number of functions, many of them used in graphics and drawing operations.

Symbols

Application Launch

func UIApplication​Main(Int32, Unsafe​Mutable​Pointer<Unsafe​Mutable​Pointer<Int8>>!, String?, String?)

This function is called in the main entry point to create the application object and the application delegate and set up the event cycle.

Image Manipulation

func UIImage​JPEGRepresentation(UIImage, CGFloat)

Returns the data for the specified image in JPEG format.

func UIImage​PNGRepresentation(UIImage)

Returns the data for the specified image in PNG format

Image and Movie Saving

func UIVideo​At​Path​Is​Compatible​With​Saved​Photos​Album(String)

Returns a Boolean value indicating whether the specified video can be saved to user’s Camera Roll album.

Graphics

func UIGraphics​Get​Current​Context()

Returns the current graphics context.

func UIGraphics​Push​Context(CGContext)

Makes the specified graphics context the current context.

func UIGraphics​Pop​Context()

Removes the current graphics context from the top of the stack, restoring the previous context.

func UIGraphics​Begin​Image​Context(CGSize)

Creates a bitmap-based graphics context and makes it the current context.

func UIGraphics​Begin​Image​Context​With​Options(CGSize, Bool, CGFloat)

Creates a bitmap-based graphics context with the specified options.

func UIGraphics​Get​Image​From​Current​Image​Context()

Returns an image based on the contents of the current bitmap-based graphics context.

func UIGraphics​End​Image​Context()

Removes the current bitmap-based graphics context from the top of the stack.

func UIRect​Clip(CGRect)

Modifies the current clipping path by intersecting it with the specified rectangle.

func UIRect​Fill(CGRect)

Fills the specified rectangle with the current color.

func UIRect​Fill​Using​Blend​Mode(CGRect, CGBlend​Mode)

Fills a rectangle with the current fill color using the specified blend mode.

func UIRect​Frame(CGRect)

Draws a frame around the inside of the specified rectangle.

func UIRect​Frame​Using​Blend​Mode(CGRect, CGBlend​Mode)

Draws a frame around the inside of a rectangle using the specified blend mode.

PDF Creation

func UIGraphics​Begin​PDFContext​To​Data(NSMutable​Data, CGRect, [Any​Hashable :​ Any]?)

Creates a PDF-based graphics context that targets the specified mutable data object.

func UIGraphics​Begin​PDFContext​To​File(String, CGRect, [Any​Hashable :​ Any]?)

Creates a PDF-based graphics context that targets a file at the specified path.

func UIGraphics​End​PDFContext()

Closes a PDF graphics context and pops it from the current context stack.

func UIGraphics​Begin​PDFPage()

Marks the beginning of a new page in a PDF context and configures it using default values.

func UIGraphics​Begin​PDFPage​With​Info(CGRect, [Any​Hashable :​ Any]?)

Marks the beginning of a new page in a PDF context and configures it using the specified values.

func UIGraphics​Get​PDFContext​Bounds()

Returns the current page bounds.

func UIGraphics​Set​PDFContext​Destination​For​Rect(String, CGRect)

Links a rectangle on the current page to the specified jump destination.

func UIGraphics​Set​PDFContext​URLFor​Rect(URL, CGRect)

Links a rectangle on the current page to the specified URL.

String Conversions

func CGAffine​Transform​From​String(String)

Returns a Core Graphics affine transform structure corresponding to the data in a given string.

func CGPoint​From​String(String)

Returns a Core Graphics point structure corresponding to the data in a given string.

func CGRect​From​String(String)

Returns a Core Graphics rectangle structure corresponding to the data in a given string.

func CGSize​From​String(String)

Returns a Core Graphics size structure corresponding to the data in a given string.

func CGVector​From​String(String)

Returns a Core Graphics vector corresponding to the data in a given string.

func NSString​From​CGAffine​Transform(CGAffine​Transform)

Returns a string formatted to contain the data from an affine transform.

func NSString​From​CGPoint(CGPoint)

Returns a string formatted to contain the data from a point.

func NSString​From​CGRect(CGRect)

Returns a string formatted to contain the data from a rectangle.

func NSString​From​CGSize(CGSize)

Returns a string formatted to contain the data from a size data structure.

func NSString​From​CGVector(CGVector)

Returns a string formatted to contain the data from a vector data structure.

func NSString​From​UIEdge​Insets(UIEdge​Insets)

Returns a string formatted to contain the data from an edge insets structure.

func NSString​From​UIOffset(UIOffset)

Returns a string formatted to contain the data from an offset structure.

func UIEdge​Insets​From​String(String)

Returns a UIKit edge insets structure corresponding to the data in a given string.

func UIOffset​From​String(String)

Returns a UIKit offset structure corresponding to the data in a given string.

Managing Edge Insets

func UIEdge​Insets​Make(CGFloat, CGFloat, CGFloat, CGFloat)

Creates an edge inset for a button or view.

func UIEdge​Insets​Equal​To​Edge​Insets(UIEdge​Insets, UIEdge​Insets)

Compares two edge insets to determine if they are the same.

func UIEdge​Insets​Inset​Rect(CGRect, UIEdge​Insets)

Adjusts a rectangle by the given edge insets.

Managing Offsets

func UIOffset​Make(CGFloat, CGFloat)

Returns an offset structure from the given components.

func UIOffset​Equal​To​Offset(UIOffset, UIOffset)

Returns a Boolean value that indicates whether two offsets are equal.

Managing Float Ranges

func UIFloat​Range​Make(CGFloat, CGFloat)

Returns a new float range structure from the given components.

func UIFloat​Range​Is​Infinite(UIFloat​Range)

Returns a Boolean indicating whether the specified float range is infinitely large.

func UIFloat​Range​Is​Equal​To​Range(UIFloat​Range, UIFloat​Range)

Returns a Boolean indicating whether two float ranges are equivalent.

Interface Orientation

func UIInterface​Orientation​Is​Portrait(UIInterface​Orientation)

Returns a Boolean value indicating whether the user interface is currently presented in a portrait orientation.

func UIInterface​Orientation​Is​Landscape(UIInterface​Orientation)

Returns a Boolean value indicating whether the user interface is currently presented in a landscape orientation.

Device Orientation

func UIDevice​Orientation​Is​Portrait(UIDevice​Orientation)

Returns a Boolean value indicating whether the device is in a portrait orientation.

func UIDevice​Orientation​Is​Landscape(UIDevice​Orientation)

Returns a Boolean value indicating whether the device is in a landscape orientation.

Interface Idiom

func UI_USER_INTERFACE_IDIOM()

Returns the interface idiom supported by the current device (recommended for apps that run in versions of iOS earlier than 3.2).

Accessibility

func UIAccessibility​Convert​Frame​To​Screen​Coordinates(CGRect, UIView)

Converts the specified rectangle from view coordinates to screen coordinates.

func UIAccessibility​Convert​Path​To​Screen​Coordinates(UIBezier​Path, UIView)

Converts the specified path object to screen coordinates and returns a new path object with the results.

func UIAccessibility​Register​Gesture​Conflict​With​Zoom()

Warns users that application-specific gestures conflict with the system-defined Zoom accessibility gestures.

func UIAccessibility​Request​Guided​Access​Session(Bool, (Bool) -> Void)

Transitions the app to or from Single App mode asynchronously.

func UIAccessibility​Zoom​Focus​Changed(UIAccessibility​Zoom​Type, CGRect, UIView)

Notifies the system that the app’s focus has changed to a new location.

func UIAccessibility​Is​Bold​Text​Enabled()

Returns a Boolean value indicating whether bold text is enabled.

func UIAccessibility​Is​Closed​Captioning​Enabled()

Returns a Boolean value indicating whether closed captioning is enabled.

func UIAccessibility​Darker​System​Colors​Enabled()

Returns a Boolean value indicating whether darken colors is enabled.

func UIAccessibility​Is​Grayscale​Enabled()

Returns a Boolean value indicating whether grayscale is enabled.

func UIAccessibility​Is​Guided​Access​Enabled()

Returns a Boolean value indicating whether the app is running in Guided Access mode.

func UIAccessibility​Is​Invert​Colors​Enabled()

Returns a Boolean value indicating whether inverted colors is enabled.

func UIAccessibility​Is​Mono​Audio​Enabled()

Returns a Boolean value indicating whether system audio is set to mono.

func UIAccessibility​Is​Reduce​Motion​Enabled()

Returns a Boolean value indicating whether reduce motion is enabled.

func UIAccessibility​Is​Reduce​Transparency​Enabled()

Returns a Boolean value indicating whether reduce transparency is enabled.

func UIAccessibility​Is​Speak​Screen​Enabled()

Returns a Boolean value indicating whether speaking the screen is enabled.

func UIAccessibility​Is​Speak​Selection​Enabled()

Returns a Boolean value indicating whether speaking the selection is enabled.

func UIAccessibility​Is​Switch​Control​Running()

Returns a Boolean value indicating whether Switch Control is enabled.

func UIAccessibility​Is​Voice​Over​Running()

Returns a Boolean value indicating whether VoiceOver is running.

Text Manipulations

func NSText​Alignment​To​CTText​Alignment(NSText​Alignment)

Converts a UIKit text alignment constant value to the matching constant value used by Core Text.

func NSText​Alignment​From​CTText​Alignment(CTText​Alignment)

Converts a Core Text alignment constant value to the matching constant value used by UIKit.

Guided Access Restriction State

func UIGuided​Access​Restriction​State​For​Identifier(String)

Returns the restriction state for the specified guided access restriction.