From 872d70dc21468c90b76d49becc38b72f7847d79e Mon Sep 17 00:00:00 2001 From: Daniel Arantes Loverde Date: Sat, 29 Aug 2026 19:34:51 -0300 Subject: [PATCH] [docs] UIKit.md: Media & Components section (UIKit.md complete) --- Documentation/UIKit.md | 114 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/Documentation/UIKit.md b/Documentation/UIKit.md index 696c795..eddf114 100644 --- a/Documentation/UIKit.md +++ b/Documentation/UIKit.md @@ -700,4 +700,116 @@ collectionView.collectionViewLayout = layout ## Media & Components - +
+LCSnackBarView — in-app notification banner + +A chainable banner shown from the top or bottom of a controller. Configure with +`configure(...)` calls, then `present()`. + +### `init(style: LCSnackBarViewType = .default, orientation: LCSnackBarOrientation = .top, delegate: LCSnackBarViewDelegate? = nil)` + +### Enums +- `LCSnackBarViewType` — `.default` (rectangular) / `.rounded` +- `LCSnackBarOrientation` — `.top` / `.bottom` +- `LCSnackBarTimer: CGFloat` — `.infinity` (0, manual dismiss), `.minimum` (2s), `.medium` (5s), `.maximum` (10s) + +### Configuration (each returns `Self`) +| Method | Sets | +|---|---| +| `configure(text: String)` | the message | +| `configure(textColor: UIColor)` | text colour | +| `configure(textFont: UIFont, alignment: NSTextAlignment = .center)` | font + alignment | +| `configure(backgroundColor: UIColor)` | banner background | +| `configure(exibition timer: LCSnackBarTimer)` | how long it stays | +| `configure(imageIconBefore icon: UIImageView, withTintColor: UIColor? = nil)` | leading icon | + +### `func present(completion: (() -> Void)? = nil)` +Show on the top-most view controller. + +### `weak var delegate: LCSnackBarViewDelegate?` +`snackbar(didStartExibition:)`, `snackbar(didTouchOn:)`, `snackbar(didEndExibition:)` — all optional. + +### Full example + +```swift +LCSnackBarView(style: .rounded, orientation: .bottom) + .configure(text: "Profile saved") + .configure(backgroundColor: .systemGreen) + .configure(exibition: .minimum) + .present() +``` + +
+ +
+ImagePickerController — camera / photo-library picker with permissions + +Wraps `UIImagePickerController`, handling camera & photo-library authorization +(including the "go to Settings" path) and presenting a source-choice alert. + +### `init()` +### `weak var delegate: ImagePickerControllerDelegate?` +### `var isEditable: Bool` — allow in-picker cropping (default `false`) +### `func openImagePicker()` +Check permissions, then present the camera/library choice. + +### `protocol ImagePickerControllerDelegate: AnyObject` +`imagePicker(didSelect image: UIImage?)` — the picked (or edited) image, or `nil` on cancel/failure. + +```swift +let picker = ImagePickerController() +picker.delegate = self +picker.isEditable = true +present(picker, animated: false) { picker.openImagePicker() } + +// ImagePickerControllerDelegate +func imagePicker(didSelect image: UIImage?) { + avatarView.image = image +} +``` + +
+ +
+ImageZoomController — full-screen pinch-zoom / pan viewer + +### `init(_ withImage: UIImage)` +### `var minimumZoomScale: CGFloat` (default `1.0`) / `var maximumZoomScale: CGFloat` (default `6.0`) +### `var addGestureToDismiss: Bool` (default `true`) — drag down to close +### `weak var delegate: ImageZoomControllerDelegate?` +### `func present(completion: (() -> Void)? = nil)` / `func dismiss(completion: (() -> Void)? = nil)` +Present from / dismiss to the top-most controller. + +### `@objc protocol ImageZoomControllerDelegate` +`imageZoomController(controller:didZoom:)`, `imageZoomController(controller:didClose:)` — both optional. + +```swift +let viewer = ImageZoomController(photo) +viewer.maximumZoomScale = 4 +viewer.present() +``` + +
+ +
+GifHelper — animated GIF loading + +### `UIImageView.loadGif(name: String)` / `UIImageView.loadGif(asset: String)` *(iOS 9+)* +Decode a bundled `.gif` (or an asset-catalog data set) off the main thread and +assign the resulting animated `UIImage`. + +```swift +bannerView.loadGif(name: "loading") // loading.gif in the bundle +bannerView.loadGif(asset: "confetti") // NSDataAsset "confetti" +``` + +### `UIImage.gif(data: Data) -> UIImage?` / `gif(url: String) -> UIImage?` / `gif(name: String) -> UIImage?` / `gif(asset: String) -> UIImage?` +Build an animated `UIImage` from GIF bytes / a URL string / a bundled file / an +asset-catalog entry. Frame delays are honoured (via the GCD of per-frame delays). + +```swift +let spinner = UIImage.gif(name: "spinner") +imageView.image = spinner +``` + +