uikit_bindings 0.0.5 copy "uikit_bindings: ^0.0.5" to clipboard
uikit_bindings: ^0.0.5 copied to clipboard

PlatformiOS

Bindings of UIKit components for Flutter using FFI.

uikit_bindings #

This plugin allows you to use native UIKit components in your Flutter app using FFI.

Bindings are generated from UIKit Headers using ffigen.

This is experimental plugin and currently only limited number of components are supported.

Available UIKit Components #

Native UIKit components running in the iOS Simulator

The example also includes a native dashboard whose state is owned by a Flutter ChangeNotifier. UIKit actions update the Dart model, and model notifications render the new state into the native controls.

Flutter ChangeNotifier driving a native UIKit dashboard

The following table shows the UIKit components that are available through the bindings:

Component Status
NSLayoutAttribute ✅ Available
NSLayoutConstraint ✅ Available
NSTextAlignment ✅ Available
UIAction ✅ Available
UIActivityIndicatorView ✅ Available
UIAlertController ✅ Available
UIApplication ✅ Available
UIBarButtonItem ✅ Available
UIBezierPath ⚠️ WIP
UIButton ✅ Available
UIColor ✅ Available
UICommand ⚠️ WIP
UIContextMenuConfiguration ⚠️ WIP
UIContextMenuInteraction ⚠️ WIP
UIEvent ⚠️ WIP
UIFocusAnimationCoordinator ⚠️ WIP
UIFocusEffect ⚠️ WIP
UIFocusMovementHint ⚠️ WIP
UIFocusUpdateContext ⚠️ WIP
UIFont ✅ Available
UIFontDescriptor ⚠️ WIP
UIGestureRecognizer ⚠️ WIP
UIImage ⚠️ WIP
UIImageView ✅ Available
UIInputViewController ⚠️ WIP
UIKeyboardLayoutGuide ⚠️ WIP
UIKeyCommand ⚠️ WIP
UILabel ✅ Available
UILayoutGuide ⚠️ WIP
UILocalNotification ⚠️ WIP
UIMenu ✅ Available
UIMenuElement ✅ Available
UINavigationBar ✅ Available
UINavigationController ✅ Available
UINavigationItem ✅ Available
UIPanGestureRecognizer ⚠️ WIP
UIPageControl ✅ Available
UIPinchGestureRecognizer ⚠️ WIP
UIPopoverPresentationController ⚠️ WIP
UIPresentationController ⚠️ WIP
UIProgressView ✅ Available
UIPressesEvent ⚠️ WIP
UIRefreshControl ⚠️ WIP
UIScene ✅ Available
UIScrollView ⚠️ WIP
UISearchController ⚠️ WIP
UISearchDisplayController ⚠️ WIP
UISheetPresentationController ⚠️ WIP
UISlider ✅ Available
UIStackView ✅ Available
UIStoryboard ⚠️ WIP
UIStoryboardSegue ⚠️ WIP
UISwitch ✅ Available
UITapGestureRecognizer ⚠️ WIP
UITextField ✅ Available
UITextInputAssistantItem ⚠️ WIP
UITextInputMode ⚠️ WIP
UIToolbar ✅ Available
UITouch ⚠️ WIP
UIUserNotificationSettings ⚠️ WIP
UIView ✅ Available
UIViewController ✅ Available
UIViewGeometry ✅ Available
UIWindow ⚠️ WIP
UIWindowScene ✅ Available

Legend #

  • Available: Fully functional with examples
  • ⚠️ Binding only: Binding exists but not tested/used in examples
  • ⚠️ No constructor: Known issue where default constructor is not available*

Helper Functions #

The library also provides several helper functions and extensions:

Function/Extension Description
UIKitColorExtension.toUIColor() Convert Flutter Color to UIColor
createCGRect() Helper to create CGRect structures
createCGSize() Helper to create CGSize structures
getKeyWindow() Find the key window for the active scene

Regenerating bindings #

This project uses Dart-API to use ffigen. To regenerate the bindings, run:

dart run tool/ffigen.dart

UIAction-based control callbacks require iOS 14 or later.