UIKit Functions

Overview

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

Symbols

Application Launch

func UIApplicationMain(Int32, UnsafeMutablePointer<UnsafeMutablePointer<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 UIImageJPEGRepresentation(UIImage, CGFloat)

Returns the data for the specified image in JPEG format.

func UIImagePNGRepresentation(UIImage)

Returns the data for the specified image in PNG format

Image and Movie Saving

func UIImageWriteToSavedPhotosAlbum(UIImage, Any?, Selector?, UnsafeMutableRawPointer?)

Adds the specified image to the user’s Camera Roll album.

func UISaveVideoAtPathToSavedPhotosAlbum(String, Any?, Selector?, UnsafeMutableRawPointer?)

Adds the movie at the specified path to the user’s Camera Roll album.

func UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(String)

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

Graphics

func UIGraphicsGetCurrentContext()

Returns the current graphics context.

func UIGraphicsPushContext(CGContext)

Makes the specified graphics context the current context.

func UIGraphicsPopContext()

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

func UIGraphicsBeginImageContext(CGSize)

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

func UIGraphicsBeginImageContextWithOptions(CGSize, Bool, CGFloat)

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

func UIGraphicsGetImageFromCurrentImageContext()

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

func UIGraphicsEndImageContext()

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

func UIRectClip(CGRect)

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

func UIRectFill(CGRect)

Fills the specified rectangle with the current color.

func UIRectFillUsingBlendMode(CGRect, CGBlendMode)

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

func UIRectFrame(CGRect)

Draws a frame around the inside of the specified rectangle.

func UIRectFrameUsingBlendMode(CGRect, CGBlendMode)

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

PDF Creation

func UIGraphicsBeginPDFContextToData(NSMutableData, CGRect, [AnyHashable : Any]?)

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

func UIGraphicsBeginPDFContextToFile(String, CGRect, [AnyHashable : Any]?)

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

func UIGraphicsEndPDFContext()

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

func UIGraphicsBeginPDFPage()

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

func UIGraphicsBeginPDFPageWithInfo(CGRect, [AnyHashable : Any]?)

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

func UIGraphicsGetPDFContextBounds()

Returns the current page bounds.

func UIGraphicsAddPDFContextDestinationAtPoint(String, CGPoint)

Creates a jump destination in the current page.

func UIGraphicsSetPDFContextDestinationForRect(String, CGRect)

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

func UIGraphicsSetPDFContextURLForRect(URL, CGRect)

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

String Conversions

func CGAffineTransformFromString(String)

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

func CGPointFromString(String)

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

func CGRectFromString(String)

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

func CGSizeFromString(String)

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

func CGVectorFromString(String)

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

func NSStringFromCGAffineTransform(CGAffineTransform)

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

func NSStringFromCGPoint(CGPoint)

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

func NSStringFromCGRect(CGRect)

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

func NSStringFromCGSize(CGSize)

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

func NSStringFromCGVector(CGVector)

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

func NSStringFromUIEdgeInsets(UIEdgeInsets)

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

func NSStringFromUIOffset(UIOffset)

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

func UIEdgeInsetsFromString(String)

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

func UIOffsetFromString(String)

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

Managing Edge Insets

func UIEdgeInsetsMake(CGFloat, CGFloat, CGFloat, CGFloat)

Creates an edge inset for a button or view.

func UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsets, UIEdgeInsets)

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

func UIEdgeInsetsInsetRect(CGRect, UIEdgeInsets)

Adjusts a rectangle by the given edge insets.

Managing Offsets

func UIOffsetMake(CGFloat, CGFloat)

Returns an offset structure from the given components.

func UIOffsetEqualToOffset(UIOffset, UIOffset)

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

Managing Float Ranges

func UIFloatRangeMake(CGFloat, CGFloat)

Returns a new float range structure from the given components.

func UIFloatRangeIsInfinite(UIFloatRange)

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

func UIFloatRangeIsEqualToRange(UIFloatRange, UIFloatRange)

Returns a Boolean indicating whether two float ranges are equivalent.

Interface Orientation

func UIInterfaceOrientationIsPortrait(UIInterfaceOrientation)

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

func UIInterfaceOrientationIsLandscape(UIInterfaceOrientation)

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

Device Orientation

func UIDeviceOrientationIsPortrait(UIDeviceOrientation)

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

func UIDeviceOrientationIsLandscape(UIDeviceOrientation)

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 UIAccessibilityConvertFrameToScreenCoordinates(CGRect, UIView)

Converts the specified rectangle from view coordinates to screen coordinates.

func UIAccessibilityConvertPathToScreenCoordinates(UIBezierPath, UIView)

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

func UIAccessibilityRegisterGestureConflictWithZoom()

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

func UIAccessibilityRequestGuidedAccessSession(Bool, (Bool) -> Void)

Transitions the app to or from Single App mode asynchronously.

func UIAccessibilityZoomFocusChanged(UIAccessibilityZoomType, CGRect, UIView)

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

func UIAccessibilityIsBoldTextEnabled()

Returns a Boolean value indicating whether bold text is enabled.

func UIAccessibilityIsClosedCaptioningEnabled()

Returns a Boolean value indicating whether closed captioning is enabled.

func UIAccessibilityDarkerSystemColorsEnabled()

Returns a Boolean value indicating whether darken colors is enabled.

func UIAccessibilityIsGrayscaleEnabled()

Returns a Boolean value indicating whether grayscale is enabled.

func UIAccessibilityIsGuidedAccessEnabled()

Returns a Boolean value indicating whether Guided Access is enabled.

func UIAccessibilityIsInvertColorsEnabled()

Returns a Boolean value indicating whether inverted colors is enabled.

func UIAccessibilityIsMonoAudioEnabled()

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

func UIAccessibilityIsReduceMotionEnabled()

Returns a Boolean value indicating whether reduce motion is enabled.

func UIAccessibilityIsReduceTransparencyEnabled()

Returns a Boolean value indicating whether reduce transparency is enabled.

func UIAccessibilityIsSpeakScreenEnabled()

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

func UIAccessibilityIsSpeakSelectionEnabled()

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

func UIAccessibilityIsSwitchControlRunning()

Returns a Boolean value indicating whether Switch Control is enabled.

func UIAccessibilityIsVoiceOverRunning()

Returns a Boolean value indicating whether VoiceOver is running.

Text Manipulations

func NSTextAlignmentToCTTextAlignment(NSTextAlignment)

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

func NSTextAlignmentFromCTTextAlignment(CTTextAlignment)

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

Guided Access Restriction State

func UIGuidedAccessRestrictionStateForIdentifier(String)

Returns the restriction state for the specified guided access restriction.