### Run pod install Source: https://jjochen.github.io/JJFloatingActionButton/index.html Command to install the dependencies specified in the Podfile. ```bash pod install ``` -------------------------------- ### Run Example Project with pod try Source: https://jjochen.github.io/JJFloatingActionButton/index.html Command to run the example project using CocoaPods. ```bash pod try JJFloatingActionButton ``` -------------------------------- ### Install CocoaPods Source: https://jjochen.github.io/JJFloatingActionButton/index.html Command to install CocoaPods, the dependency manager used to integrate JJFloatingActionButton. ```bash gem install cocoapods ``` -------------------------------- ### Quick Start with JJFloatingActionButton Source: https://jjochen.github.io/JJFloatingActionButton/index.html Basic setup to create a floating action button, add items, and place it using Auto Layout. The last four lines can be replaced with actionButton.display(inViewController: self). ```swift let actionButton = JJFloatingActionButton() actionButton.addItem(title: "item 1", image: UIImage(named: "First")?.withRenderingMode(.alwaysTemplate)) { item in // do something } actionButton.addItem(title: "item 2", image: UIImage(named: "Second")?.withRenderingMode(.alwaysTemplate)) { item in // do something } actionButton.addItem(title: "item 3", image: nil) { item in // do something } view.addSubview(actionButton) actionButton.translatesAutoresizingMaskIntoConstraints = false actionButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16).isActive = true actionButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -16).isActive = true // last 4 lines can be replaced with // actionButton.display(inViewController: self) ``` -------------------------------- ### Initialize JJFloatingActionButton Source: https://jjochen.github.io/JJFloatingActionButton/Classes.html Example of creating a floating action button and adding items to it. ```Swift let actionButton = JJFloatingActionButton() actionButton.addItem(title: "item 1", image: image1) { item in // do something } actionButton.addItem(title: "item 2", image: image2) { item in // do something } view.addSubview(actionButton) ``` -------------------------------- ### configureDefaultItem(_:) Usage Example Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Shows how to configure default properties for all action items added to the floating action button. The closure is called on each item that is or was added. ```swift let actionButton = JJFloatingActionButton() actionButton.configureDefaultItem { item in item.imageView.contentMode = .scaleAspectFill item.titleLabel.font = .systemFont(ofSize: 14) item.layer.shadowColor = UIColor.black.cgColor item.layer.shadowOpacity = 0.3 item.layer.shadowOffset = CGSize(width: 1, height: 1) item.layer.shadowRadius = 0 } ``` -------------------------------- ### init(prepare:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Initializes and returns a newly allocated item preparation object with a given prepare closure. ```APIDOC ## init(prepare:) ### Description Initializes and returns a newly allocated item preparation object with a given prepare closure. ### Declaration ```swift @objc public init(prepare: @escaping (_ item: JJActionItem, _ index: Int, _ numberOfItems: Int, _ actionButton: JJFloatingActionButton) -> Void) ``` ### Parameters - **_layout_** (closure) - A closure that defines the layout of given action items relative to an action button. ### Return Value An initialized item preparation object. ``` -------------------------------- ### init?(coder:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Initializes a floating action button from data in an unarchiver. ```APIDOC ## init?(coder:) ### Description Returns an object initialized from data in a given unarchiver. ### Declaration ```swift public required init?(coder aDecoder: NSCoder) ``` ### Parameters - **aDecoder** (NSCoder) - Required - An unarchiver object. ### Return Value `self`, initialized using the data in decoder. ``` -------------------------------- ### Initialize with image and action Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Creates a button with a specific image and an optional action handler. ```Swift @objc public convenience init(image: UIImage, action: ((JJActionItem) -> Void)? = nil) ``` -------------------------------- ### init(image:action:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Initializes a floating action button with an image and an optional action handler. ```APIDOC ## init(image:action:) ### Description Initializes and returns a newly allocated floating action button object with the specified image and action. ### Declaration ```swift @objc public convenience init(image: UIImage, action: ((JJActionItem) -> Void)? = nil) ``` ### Parameters - **image** (UIImage) - Required - The image of the action item. Default is `nil`. - **action** ((JJActionItem) -> Void)? - Optional - The action handler of the action item. Default is `nil`. ### Return Value An initialized floating action button object. ``` -------------------------------- ### init(withStyle:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJButtonAnimationConfiguration.html Initializes a button animation configuration object with the specified animation style. ```APIDOC ## init(withStyle:) ### Description Initializes and returns a newly allocated button animation configuration object with the specified style. ### Declaration ```swift @objc public init(withStyle style: JJButtonAnimationStyle) ``` ### Parameters - **style** (JJButtonAnimationStyle) - Required - The animation style. ### Return Value An initialized button animation configuration object. ``` -------------------------------- ### init(frame:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Initializes a floating action button with a specified frame rectangle. ```APIDOC ## init(frame:) ### Description Initializes and returns a newly allocated floating action button object with the specified frame rectangle. ### Declaration ```swift override public init(frame: CGRect) ``` ### Parameters - **frame** (CGRect) - Required - The frame rectangle for the floating action button, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly. ### Return Value An initialized floating action button object. ``` -------------------------------- ### open(animated:completion:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Opens the floating action button and shows all action items. ```APIDOC ## open(animated:completion:) ### Description Open the floating action button and show all action items. Hidden items and items that have user interaction disabled are omitted. ### Declaration ```swift func open(animated: Bool = true, completion: (() -> Void)? = nil) ``` ### Parameters - **animated** (Bool) - Optional - When true, button will be opened with an animation. Default is `true`. - **completion** (() -> Void)? - Optional - Will be handled upon completion. Default is `nil`. ``` -------------------------------- ### Opening Animation Configuration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemAnimationConfiguration.html Animation settings for the opening animation. ```Swift @objc public lazy var opening: JJAnimationSettings { get set } ``` -------------------------------- ### transition(toImage:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJButtonAnimationConfiguration.html Returns a button animation configuration that transitions to a given image. ```APIDOC ## transition(toImage:) ### Description Returns a button animation configuration that transitions to a given image. ### Declaration ```swift static func transition(toImage image: UIImage) -> JJButtonAnimationConfiguration ``` ### Parameters - **image** (UIImage) - Required - The image button will transition to when opening. ### Return Value A button animation configuration object. ``` -------------------------------- ### Open State Configuration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemAnimationConfiguration.html Configures the items for the open state. ```Swift @objc public var openState: JJItemPreparation ``` -------------------------------- ### Initialize JJItemPreparation Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Initializes a new item preparation object with a specific prepare closure. ```Swift @objc public init(prepare: @escaping (_ item: JJActionItem, _ index: Int, _ numberOfItems: Int, _ actionButton: JJFloatingActionButton) -> Void) ``` -------------------------------- ### Scale Preparation Method Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that sets the item's alpha to 0 and scales it by a given ratio. ```Swift @objc public static func scale(by ratio: CGFloat = 0.4) -> JJItemPreparation ``` -------------------------------- ### scale(by:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that sets item.alpha to 0 and scales the item by a given ratio. ```APIDOC ## scale(by:) ### Description Returns an item preparation object that sets item.alpha to 0 and scales the item by a given ratio. ### Declaration ```swift @objc public static func scale(by ratio: CGFloat = 0.4) -> JJItemPreparation ``` ### Parameters - **ratio** (CGFloat) - The factor by which the item is scaled. Default is 0.4. ### Return Value An item preparation object. ``` -------------------------------- ### JJItemLayout Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemLayout.html Documentation for the JJItemLayout class, including its properties, initializer, and static factory methods. ```APIDOC ## JJItemLayout ### Description A class that defines the layout of action items relative to an action button. ### Declaration ```swift @objc public class JJItemLayout : NSObject ``` ### Properties - **layout** (`(_ items: [JJActionItem], _ actionButton: JJFloatingActionButton) -> Void`) - A closure that defines the layout of given action items relative to an action button. ### Initializers - **init(layout:)** - Initializes and returns a newly allocated item layout object with given layout closure. - Parameters: - `_layout_` (closure) - A closure that defines the layout of given action items relative to an action button. - Return Value: An initialized item layout object. ### Class Methods - **verticalLine(withInterItemSpacing:firstItemSpacing:)** - Returns an item layout object that places the items in a vertical line with given inter item spacing. - Parameters: - `_interItemSpacing_` (CGFloat) - The distance between two adjacent items. Default is 12. - `_firstItemSpacing_` (CGFloat) - The distance between the action button and the first action item. When `firstItemSpacing` is 0 or less `interItemSpacing` is used instead. Default is 0. - Return Value: An item layout object. - **circular(withRadius:angleForItem:)** - Returns an item layout object that places the items in a circle around the action button with given radius. - Parameters: - `_radius_` (CGFloat) - The distance between the center of an item and the center of the button itself. Default is 100. - `_angleForItem_` (closure) - A closure that calculates the angle for each item in a floating action button. Default is `JJItemAnimationConfiguration.angleForItem`. - Return Value: An item layout object. ``` -------------------------------- ### Offset Preparation Method Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that sets the item's alpha to 0, offsets it by given values, and scales it. ```Swift @objc public static func offset(translationX: CGFloat, translationY: CGFloat, scale: CGFloat = 0.4) -> JJItemPreparation ``` -------------------------------- ### Closed State Configuration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemAnimationConfiguration.html Configures the items before opening. ```Swift @objc public var closedState: JJItemPreparation ``` -------------------------------- ### Horizontal Offset Preparation Method Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that offsets the item horizontally towards the closest vertical screen edge. ```Swift @objc public static func horizontalOffset(distance: CGFloat = 50, scale: CGFloat = 0.4) -> JJItemPreparation ``` -------------------------------- ### init(duration:dampingRatio:initialVelocity:interItemDelay:) Initializer Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJAnimationSettings.html Initializes a new JJAnimationSettings object with the specified parameters. ```swift @objc public convenience init(duration: TimeInterval = 0.3, dampingRatio: CGFloat = 0.55, initialVelocity: CGFloat = 0.3, interItemDelay: TimeInterval = 0.1) ``` -------------------------------- ### JJItemAnimationConfiguration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemAnimationConfiguration.html Documentation for the JJItemAnimationConfiguration class, including its properties and static factory methods for configuring item animations in a floating action button. ```APIDOC ## JJItemAnimationConfiguration ### Description Configuration for the animation of the action items in a floating action button. ### Properties #### opening - **Type**: `JJAnimationSettings` - **Declaration**: `@objc public lazy var opening: JJAnimationSettings { get set }` - **Description**: Animation settings for opening animation. Default values: `duration = 0.3`, `dampingRatio = 0.55`, `initialVelocity = 0.3`, `interItemDelay = 0.1`. #### closing - **Type**: `JJAnimationSettings` - **Declaration**: `@objc public lazy var closing: JJAnimationSettings { get set }` - **Description**: Animation settings for closing animation. Default values: `duration = 0.3`, `dampingRatio = 0.6`, `initialVelocity = 0.8`, `interItemDelay = 0.1`. #### itemLayout - **Type**: `JJItemLayout` - **Declaration**: `@objc public var itemLayout: JJItemLayout` - **Description**: Defines the layout of the action items when opened. Default is a vertical line with 12 points inter item spacing. #### closedState - **Type**: `JJItemPreparation` - **Declaration**: `@objc public var closedState: JJItemPreparation` - **Description**: Configures the items before opening. The change from open to closed state is animated. Default is a scale by factor `0.4` and `item.alpha = 0`. #### openState - **Type**: `JJItemPreparation` - **Declaration**: `@objc public var openState: JJItemPreparation` - **Description**: Configures the items for open state. The change from open to closed state is animated. Default is `item.transform = .identity` and `item.alpha = 1`. ### Methods #### popUp(withInterItemSpacing:firstItemSpacing:) - **Declaration**: `static func popUp(withInterItemSpacing interItemSpacing: CGFloat = 12, firstItemSpacing: CGFloat = 0) -> JJItemAnimationConfiguration` - **Description**: Returns an item animation configuration with `itemLayout = .verticalLine()` and `closedState = .scale()`. - **Parameters**: - `interItemSpacing` (CGFloat) - The distance between two adjacent items. Default is `12`. - `firstItemSpacing` (CGFloat) - The distance between the action button and the first action item. When `firstItemSpacing` is `0` or less `interItemSpacing` is used instead. Default is `0`. - **Return Value**: An item animation configuration object. #### slideIn(withInterItemSpacing:firstItemSpacing:) - **Declaration**: `static func slideIn(withInterItemSpacing interItemSpacing: CGFloat = 12, firstItemSpacing: CGFloat = 0) -> JJItemAnimationConfiguration` - **Description**: Returns an item animation configuration with `itemLayout = .verticalLine()` and `closedState = .horizontalOffset()`. - **Parameters**: - `interItemSpacing` (CGFloat) - The distance between two adjacent items. Default is `12`. - `firstItemSpacing` (CGFloat) - The distance between the action button and the first action item. When `firstItemSpacing` is `0` or less `interItemSpacing` is used instead. Default is `0`. - **Return Value**: An item animation configuration object. #### circularPopUp(withRadius:angleForItem:) - **Declaration**: `static func circularPopUp(withRadius radius: CGFloat = 100, angleForItem: @escaping JJItemAngle = JJItemAnimationConfiguration.angleForItem) -> JJItemAnimationConfiguration` - **Description**: Returns an item animation configuration with `itemLayout = .circular()` and `closedState = .scale()`. - **Parameters**: - `radius` (CGFloat) - The distance between the center of an item and the center of the button itself. - `angleForItem` (JJItemAngle) - A closure that calculates the angle for each item in a floating action button. Default is `JJItemAnimationConfiguration.angleForItem`. - **Return Value**: An item animation configuration object. #### circularSlideIn(withRadius:angleForItem:) - **Declaration**: `static func circularSlideIn(withRadius radius: CGFloat = 100, angleForItem: @escaping JJItemAngle = JJItemAnimationConfiguration.angleForItem) -> JJItemAnimationConfiguration` - **Description**: Returns an item animation configuration with `itemLayout = .circular()` and `closedState = .circularOffset()`. - **Parameters**: - `radius` (CGFloat) - The distance between the center of an item and the center of the button itself. - `angleForItem` (JJItemAngle) - A closure that calculates the angle for each item in a floating action button. Default is `JJItemAnimationConfiguration.angleForItem`. - **Return Value**: An item animation configuration object. #### angleForItem(at:numberOfItems:actionButton:) - **Declaration**: `@objc static func angleForItem(at index: Int, numberOfItems: Int, actionButton: JJFloatingActionButton) -> CGFloat` - **Description**: Calculates the angle for the item at the specified index in the floating action button. - **Parameters**: - `index` (Int) - The index of the item. - `numberOfItems` (Int) - The total number of items in the floating action button. - `actionButton` (JJFloatingActionButton) - The floating action button. - **Return Value**: The angle in radians for the item at the specified index. ``` -------------------------------- ### prepare Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html A closure that prepares a given action item for animation. It receives the item, its index, the total number of items, and the action button. ```APIDOC ## prepare ### Description A closure that prepares a given action item for animation. It receives the item, its index, the total number of items, and the action button. ### Declaration ```swift @objc public var prepare: (_ item: JJActionItem, _ index: Int, _ numberOfItems: Int, _ actionButton: JJFloatingActionButton) -> Void ``` ### Parameters - **item** (JJActionItem) - The action item to prepare - **index** (Int) - The index of the item - **numberOfItems** (Int) - The total number of items - **actionButton** (JJFloatingActionButton) - The action button ### Return Value Void ``` -------------------------------- ### Initialize with frame Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Initializes a new floating action button with a specified frame rectangle. ```Swift override public init(frame: CGRect) ``` -------------------------------- ### identity() Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that sets item.alpha to 1 and item.transform to identity. ```APIDOC ## identity() ### Description Returns an item preparation object that sets item.alpha to 1 and item.transform to identity. ### Declaration ```swift @objc public static func identity() -> JJItemPreparation ``` ### Return Value An item preparation object. ``` -------------------------------- ### Item Layout Configuration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemAnimationConfiguration.html Defines the layout of the action items when opened. ```Swift @objc public var itemLayout: JJItemLayout ``` -------------------------------- ### Circular Offset Preparation Method Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that offsets the item towards the action button. ```Swift @objc public static func circularOffset(distance: CGFloat = 50, scale: CGFloat = 0.4, angleForItem: @escaping JJItemAngle = JJItemAnimationConfiguration.angleForItem) -> JJItemPreparation ``` -------------------------------- ### Identity Preparation Method Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that sets the item's alpha to 1 and transform to identity. ```Swift @objc public static func identity() -> JJItemPreparation ``` -------------------------------- ### init(coder:) declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJActionItem.html Declares the required initializer init?(coder:) that returns an object initialized from data in a given unarchiver. ```swift public required init?(coder aDecoder: NSCoder) ``` -------------------------------- ### addItem(_:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Adds an action item to the list of items. The item will be updated with the default configuration values. ```APIDOC ## addItem(_:) ### Description Adds an action item to the list of items. The item will be updated with the default configuration values. ### Declaration ```swift func addItem(_ item: JJActionItem) ``` ### Parameters - **item** (JJActionItem) - Required - The action item. ``` -------------------------------- ### Declare JJItemPreparation Source: https://jjochen.github.io/JJFloatingActionButton/Classes.html Item preparation class declaration. ```Swift @objc public class JJItemPreparation : NSObject ``` -------------------------------- ### floatingActionButtonWillOpen(_:) Source: https://jjochen.github.io/JJFloatingActionButton/Protocols/JJFloatingActionButtonDelegate.html Called before the opening animation begins. The button state is .opening. ```APIDOC ## floatingActionButtonWillOpen(_:) ### Description Called before the opening animation begins. The button state is .opening. ### Declaration ```swift @objc optional func floatingActionButtonWillOpen(_ button: JJFloatingActionButton) ``` ### Parameters - **button** (JJFloatingActionButton) - The floating action button that is about to open. ``` -------------------------------- ### JJCircleView Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJCircleView.html Documentation for the JJCircleView class, a colored circle with a highlighted state. ```APIDOC ## JJCircleView ### Description A colored circle with an highlighted state. ### Declaration ```swift @objc @IBDesignable public class JJCircleView : UIView ``` ### Properties #### color - **Type**: `UIColor` - **Declaration**: `@IBInspectable public dynamic var color: UIColor { get set }` - **Description**: The color of the circle. #### highlightedColor - **Type**: `UIColor?` - **Declaration**: `@IBInspectable public dynamic var highlightedColor: UIColor? { get set }` - **Description**: The color of the circle when highlighted. Default is `nil`. #### isHighlighted - **Type**: `Bool` - **Declaration**: `@objc public var isHighlighted: Bool { get set }` - **Description**: A Boolean value indicating whether the circle view draws a highlight. Default is `false`. ### Initializers #### init(coder:) - **Declaration**: `public required init?(coder aDecoder: NSCoder)` - **Parameters**: - `aDecoder` (NSCoder) - An unarchiver object. - **Return Value**: `self`, initialized using the data in decoder. ### Methods #### draw(_:) - **Declaration**: `override public func draw(_: CGRect)` - **Description**: Draws the receiver’s image within the passed-in rectangle. Overrides `draw(rect: CGRect)` from `UIView`. ``` -------------------------------- ### offset(translationX:translationY:scale:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that sets item.alpha to 0, offsets the item by given translation values, and scales the item by a given ratio. ```APIDOC ## offset(translationX:translationY:scale:) ### Description Returns an item preparation object that sets item.alpha to 0, offsets the item by given horizontal and vertical values, and scales the item by a given ratio. ### Declaration ```swift @objc public static func offset(translationX: CGFloat, translationY: CGFloat, scale: CGFloat = 0.4) -> JJItemPreparation ``` ### Parameters - **translationX** (CGFloat) - The value in points by which the item is offsetted horizontally - **translationY** (CGFloat) - The value in points by which the item is offsetted vertically - **scale** (CGFloat) - The factor by which the item is scaled. Default is 0.4. ### Return Value An item preparation object. ``` -------------------------------- ### JJItemLayout Initializer Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemLayout.html Initializes the item layout object with a given layout closure. It accepts an escaping closure for the layout. ```Swift @objc public init(layout: @escaping (_ items: [JJActionItem], _ actionButton: JJFloatingActionButton) -> Void) ``` -------------------------------- ### JJFloatingActionButton Delegate Methods Source: https://jjochen.github.io/JJFloatingActionButton/index.html Optional delegate methods to observe the button's open and close events. ```swift optional func floatingActionButtonWillOpen(_ button: JJFloatingActionButton) optional func floatingActionButtonDidOpen(_ button: JJFloatingActionButton) optional func floatingActionButtonWillClose(_ button: JJFloatingActionButton) optional func floatingActionButtonDidClose(_ button: JJFloatingActionButton) ``` -------------------------------- ### Closing Animation Configuration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemAnimationConfiguration.html Animation settings for the closing animation. ```Swift @objc public lazy var closing: JJAnimationSettings { get set } ``` -------------------------------- ### addItem(title:image:action:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Adds an action item with title, image, and action to the list of items. The item will be preconfigured with the default values. ```APIDOC ## addItem(title:image:action:) ### Description Adds an action item with title, image, and action to the list of items. The item will be preconfigured with the default values. ### Declaration ```swift @discardableResult func addItem(title: String? = nil, image: UIImage? = nil, action: ((JJActionItem) -> Void)? = nil) -> JJActionItem ``` ### Parameters - **title** (String?) - Optional - The title of the action item. Default is `nil`. - **image** (UIImage?) - Optional - The image of the action item. Default is `nil`. - **action** ((JJActionItem) -> Void?) - Optional - The action handler of the action item. Default is `nil`. ### Return Value The item that was added. This can be configured after it has been added. ``` -------------------------------- ### configureDefaultItem(_:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Calls the given closure on each item that is or was added to the floating action button. Default is `nil`. ```APIDOC ## configureDefaultItem(_:) ### Description Calls the given closure on each item that is or was added to the floating action button. Default is `nil`. ### Declaration ```swift func configureDefaultItem(_ body: ((JJActionItem) -> Void)?) ``` ### Parameters - **body** ((JJActionItem) -> Void?) - Optional - A closure that takes an action item as a parameter. ``` -------------------------------- ### display(inView:bottomInset:trailingInset:safeAreaInset:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Displays the floating action button in a given superview with configurable insets. ```APIDOC ## display(inView:bottomInset:trailingInset:safeAreaInset:) ### Description Add floating action button to a given superview and place in trailing bottom corner. On iOS prior to iOS 11 `safeAreaInset` is ignored. ### Declaration ```swift func display(inView superview: UIView, bottomInset: CGFloat = 16, trailingInset: CGFloat = 16, safeAreaInset: CGFloat = 0) ``` ### Parameters - **superview** (UIView) - Required - The view to which the floating action button is added as a subview. - **bottomInset** (CGFloat) - Optional - The (minimum) bottom vertical spacing in points between button and superview. Default is `16`. - **trailingInset** (CGFloat) - Optional - The (minimum) trailing horizontal spacing in points between button and superview. Default is `16`. - **safeAreaInset** (CGFloat) - Optional - The (minimum) spacing in points between button and safe area of the superview. Default is `0`. ``` -------------------------------- ### floatingActionButtonWillOpen Delegate Method Source: https://jjochen.github.io/JJFloatingActionButton/Protocols/JJFloatingActionButtonDelegate.html Called before the opening animation begins, with the button state set to .opening. ```swift @objc optional func floatingActionButtonWillOpen(_ button: JJFloatingActionButton) ``` -------------------------------- ### addItem(title:image:action:) Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Declares the method to add an action item with title, image, and action. The item is pre-configured with default values. Returns the added item for further configuration. ```swift @discardableResult func addItem(title: String? = nil, image: UIImage? = nil, action: ((JJActionItem) -> Void)? = nil) -> JJActionItem ``` -------------------------------- ### Declare JJItemAnimationConfiguration Source: https://jjochen.github.io/JJFloatingActionButton/Classes.html Item animation configuration class declaration. ```Swift @objc public class JJItemAnimationConfiguration : NSObject ``` -------------------------------- ### PopUp Animation Factory Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemAnimationConfiguration.html Returns an item animation configuration with vertical line layout and scale closed state. ```Swift static func popUp(withInterItemSpacing interItemSpacing: CGFloat = 12, firstItemSpacing: CGFloat = 0) -> JJItemAnimationConfiguration ``` -------------------------------- ### Declare JJButtonAnimationConfiguration Source: https://jjochen.github.io/JJFloatingActionButton/Classes.html Button animation configuration class declaration. ```Swift @objc public class JJButtonAnimationConfiguration : NSObject ``` -------------------------------- ### Open button Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Opens the floating action button to display its action items, optionally with an animation. ```Swift func open(animated: Bool = true, completion: (() -> Void)? = nil) ``` -------------------------------- ### Configure JJFloatingActionButton Appearance and Behavior Source: https://jjochen.github.io/JJFloatingActionButton/index.html Customize the button's diameter, colors, animations, shadow, item size ratio, and default item appearance. Also shows adding items with custom configuration. ```swift actionButton.handleSingleActionDirectly = false actionButton.buttonDiameter = 65 actionButton.overlayView.backgroundColor = UIColor(white: 0, alpha: 0.3) actionButton.buttonImage = UIImage(named: "Dots") actionButton.buttonColor = .red actionButton.buttonImageColor = .white actionButton.buttonImageSize = CGSize(width: 30, height: 30) actionButton.buttonAnimationConfiguration = .transition(toImage: UIImage(named: "X")) actionButton.itemAnimationConfiguration = .slideIn(withInterItemSpacing: 14) actionButton.layer.shadowColor = UIColor.black.cgColor actionButton.layer.shadowOffset = CGSize(width: 0, height: 1) actionButton.layer.shadowOpacity = Float(0.4) actionButton.layer.shadowRadius = CGFloat(2) actionButton.itemSizeRatio = CGFloat(0.75) actionButton.configureDefaultItem { item in item.titlePosition = .trailing item.titleLabel.font = .boldSystemFont(ofSize: UIFont.systemFontSize) item.titleLabel.textColor = .white item.buttonColor = .white item.buttonImageColor = .red item.layer.shadowColor = UIColor.black.cgColor item.layer.shadowOffset = CGSize(width: 0, height: 1) item.layer.shadowOpacity = Float(0.4) item.layer.shadowRadius = CGFloat(2) } actionButton.addItem(title: "Balloon", image: UIImage(named: "Balloon")) { item in // Do something } let item = actionButton.addItem() item.titleLabel.text = "Owl" item.imageView.image = UIImage(named: "Owl") item.buttonColor = .black item.buttonImageColor = .white item.buttonImageColor = CGSize(width: 30, height: 30) item.action = { item in // Do something } ``` -------------------------------- ### horizontalOffset(distance:scale:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that sets item.alpha to 0 and offsets the item horizontally towards the closest vertical edge of the screen. ```APIDOC ## horizontalOffset(distance:scale:) ### Description Returns an item preparation object that sets item.alpha to 0 and offsets the item horizontally towards the closest vertical edge of the screen. ### Declaration ```swift @objc public static func horizontalOffset(distance: CGFloat = 50, scale: CGFloat = 0.4) -> JJItemPreparation ``` ### Parameters - **distance** (CGFloat) - The value in points by which the item is offsetted horizontally towards the closest vertical edge of the screen. Default is 50. - **scale** (CGFloat) - The factor by which the item is scaled. Default is 0.4. ### Return Value An item preparation object. ``` -------------------------------- ### floatingActionButtonDidOpen(_:) Source: https://jjochen.github.io/JJFloatingActionButton/Protocols/JJFloatingActionButtonDelegate.html Called after the opening animation completes. The button state is .opened. ```APIDOC ## floatingActionButtonDidOpen(_:) ### Description Called after the opening animation completes. The button state is .opened. ### Declaration ```swift @objc optional func floatingActionButtonDidOpen(_ button: JJFloatingActionButton) ``` ### Parameters - **button** (JJFloatingActionButton) - The floating action button that has opened. ``` -------------------------------- ### JJFloatingActionButtonDelegate Protocol Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Protocols/JJFloatingActionButtonDelegate.html The base protocol definition for the floating action button delegate. ```swift @objc public protocol JJFloatingActionButtonDelegate ``` -------------------------------- ### didMoveToSuperview() Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Tells the view that its superview changed. ```APIDOC ## didMoveToSuperview() ### Description Tells the view that its superview changed. ### Declaration ```swift override public func didMoveToSuperview() ``` ``` -------------------------------- ### Podfile for JJFloatingActionButton Source: https://jjochen.github.io/JJFloatingActionButton/index.html Specify JJFloatingActionButton in your Podfile to integrate it into your Xcode project using CocoaPods. ```ruby source 'https://cdn.cocoapods.org/' platform :ios, '13.0' use_frameworks! target '' do pod 'JJFloatingActionButton' end ``` -------------------------------- ### addItem(_:) Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Declares the method to add an existing JJActionItem to the list. The item is updated with default configuration values. ```swift func addItem(_ item: JJActionItem) ``` -------------------------------- ### JJAnimationSettings Class Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJAnimationSettings.html The base class definition for animation settings. ```swift @objc public class JJAnimationSettings : NSObject ``` -------------------------------- ### display(inViewController:bottomInset:trailingInset:safeAreaInset:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Displays the floating action button in a view controller's view with configurable insets. ```APIDOC ## display(inViewController:bottomInset:trailingInset:safeAreaInset:) ### Description Add floating action button to a view of a given view controller and place in trailing bottom corner. On iOS prior to iOS 11 `safeAreaInset` is ignored. ### Declaration ```swift func display(inViewController viewController: UIViewController, bottomInset: CGFloat = 16, trailingInset: CGFloat = 16, safeAreaInset: CGFloat = 0) ``` ### Parameters - **viewController** (UIViewController) - Required - The view controller to which view the floating action button is added as a subview. - **bottomInset** (CGFloat) - Optional - The (minimum) bottom vertical spacing in points between button and superview. Default is `16`. - **trailingInset** (CGFloat) - Optional - The (minimum) trailing horizontal spacing in points between button and superview. Default is `16`. - **safeAreaInset** (CGFloat) - Optional - The (minimum) spacing in points between button and safe area of the view controllers view. Default is `0`. ``` -------------------------------- ### Display in view Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Adds the floating action button to a superview at the trailing bottom corner. ```Swift func display(inView superview: UIView, bottomInset: CGFloat = 16, trailingInset: CGFloat = 16, safeAreaInset: CGFloat = 0) ``` -------------------------------- ### Prepare Closure Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html The closure property used to prepare an action item for animation. ```Swift @objc public var prepare: (_ item: JJActionItem, _ index: Int, _ numberOfItems: Int, _ actionButton: JJFloatingActionButton) -> Void ``` -------------------------------- ### circularOffset(distance:scale:angleForItem:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemPreparation.html Returns an item preparation object that sets item.alpha to 0 and offsets the item towards the action button using a circular angle calculation. ```APIDOC ## circularOffset(distance:scale:angleForItem:) ### Description Returns an item preparation object that sets item.alpha to 0 and offsets the item towards the action button using a given angle calculation. ### Declaration ```swift @objc public static func circularOffset(distance: CGFloat = 50, scale: CGFloat = 0.4, angleForItem: @escaping JJItemAngle = JJItemAnimationConfiguration.angleForItem) -> JJItemPreparation ``` ### Parameters - **distance** (CGFloat) - The value in points by which the item is offsetted towards the action button. Default is 50. - **scale** (CGFloat) - The factor by which the item is scaled. Default is 0.4. - **angleForItem** (JJItemAngle) - A closure that calculates the angle for each item in a floating action button. Default is `JJItemAnimationConfiguration.angleForItem`. ### Return Value An item preparation object. ``` -------------------------------- ### configureDefaultItem(_:) Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Declares the method to set a closure that configures default properties for action items. ```swift func configureDefaultItem(_ body: ((JJActionItem) -> Void)?) ``` -------------------------------- ### SlideIn Animation Factory Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemAnimationConfiguration.html Returns an item animation configuration with vertical line layout and horizontal offset closed state. ```Swift static func slideIn(withInterItemSpacing interItemSpacing: CGFloat = 12, firstItemSpacing: CGFloat = 0) -> JJItemAnimationConfiguration ``` -------------------------------- ### CircularPopUp Animation Factory Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemAnimationConfiguration.html Returns an item animation configuration with circular layout and scale closed state. ```Swift static func circularPopUp(withRadius radius: CGFloat = 100, angleForItem: @escaping JJItemAngle = JJItemAnimationConfiguration.angleForItem) -> JJItemAnimationConfiguration ``` -------------------------------- ### intrinsicContentSize Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html The natural size for the floating action button. ```APIDOC ## intrinsicContentSize ### Description The natural size for the floating action button. ### Declaration ```swift override open var intrinsicContentSize: CGSize { get } ``` ``` -------------------------------- ### shadowOpacity Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html The shadow opacity of the floating action button. Default is `0.4`. ```APIDOC ## shadowOpacity ### Description The shadow opacity of the floating action button. Default is `0.4`. ### Declaration ```swift @IBInspectable dynamic var shadowOpacity: Float { get set } ``` ``` -------------------------------- ### enabledItems Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html All items that will be shown when floating action button is opened. This excludes hidden items and items that have user interaction disabled. ```APIDOC ## enabledItems ### Description All items that will be shown when floating action button is opened. This excludes hidden items and items that have user interaction disabled. ### Declaration ```swift var enabledItems: [JJActionItem] { get } ``` ``` -------------------------------- ### rotation(toAngle:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJButtonAnimationConfiguration.html Returns a button animation configuration that rotates the button image by the given angle. ```APIDOC ## rotation(toAngle:) ### Description Returns a button animation configuration that rotates the button image by the given angle. ### Declaration ```swift static func rotation(toAngle angle: CGFloat = -.pi / 4) -> JJButtonAnimationConfiguration ``` ### Parameters - **angle** (CGFloat) - Optional - The angle in radian the button will rotate to when opening. Default is -.pi / 4. ### Return Value A button animation configuration object. ``` -------------------------------- ### floatingActionButtonDidOpen Delegate Method Source: https://jjochen.github.io/JJFloatingActionButton/Protocols/JJFloatingActionButtonDelegate.html Called after the opening animation completes, with the button state set to .opened. ```swift @objc optional func floatingActionButtonDidOpen(_ button: JJFloatingActionButton) ``` -------------------------------- ### Declare JJActionItem Source: https://jjochen.github.io/JJFloatingActionButton/Classes.html The item view representing an action class declaration. ```Swift @objc @IBDesignable open class JJActionItem : UIControl ``` -------------------------------- ### didMoveToSuperview() Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Declares the method that tells the view that its superview changed. ```swift override public func didMoveToSuperview() ``` -------------------------------- ### JJItemLayout layout Property Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemLayout.html A closure property that defines the layout of action items relative to an action button. ```Swift @objc public var layout: (_ items: [JJActionItem], _ actionButton: JJFloatingActionButton) -> Void ``` -------------------------------- ### JJActionItem Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJActionItem.html Documentation for the JJActionItem class, a UIControl subclass representing an action item in a floating action button menu. ```APIDOC ## JJActionItem ### Description Represents an action item in a floating action button menu. It is a UIControl subclass that can be configured with a title, image, and colors, and executes an action when tapped. ### Properties - **action** (`((JJActionItem) -> Void)?`) - The action to execute when the item is tapped. Default is `nil`. - **buttonColor** (`UIColor`) - The color of the action item circle view. Default is `UIColor.white`. - **highlightedButtonColor** (`UIColor?`) - The color of the circle view when highlighted. Default is `nil`. - **buttonImage** (`UIImage?`) - The image displayed by the item. Default is `nil`. - **buttonImageColor** (`UIColor`) - The tint color of the image view. Default is the color of the floating action button. Only template images are colored. - **titleLabel** (`UILabel`) - The title label of the item. Read-only. - **imageView** (`UIImageView`) - The image view of the item. Read-only. - **circleView** (`JJCircleView`) - The background circle of the item. Read-only. - **titlePosition** (`JJActionItemTitlePosition`) - The position of the title label. Default is `.leading`. - **titleSpacing** (`CGFloat`) - The spacing between the title and the circle. Default is `-1` (uses default spacing: horizontal 12, vertical 4). - **imageSize** (`CGSize`) - The size of the image view. Default is `(0, 0)`. When zero, the image is shrunken to fit inside the circle view. ### Methods #### callAction() Calls the action on the action item. **Declaration** ```swift @objc public func callAction() ``` #### init?(coder:) Returns an object initialized from data in a given unarchiver. **Parameters** - `aDecoder` (`NSCoder`) - An unarchiver object. **Return Value** `self`, initialized using the data in decoder. **Declaration** ```swift public required init?(coder aDecoder: NSCoder) ``` #### didMoveToSuperview() Tells the view that its superview changed. **Declaration** ```swift override open func didMoveToSuperview() ``` #### updateConstraints() Updates constraints for the view. **Declaration** ```swift override open func updateConstraints() ``` #### isHighlighted A Boolean value indicating whether the action item draws a highlight. **Declaration** ```swift override open var isHighlighted: Bool { get set } ``` ``` -------------------------------- ### Declare JJFloatingActionButtonState enumeration Source: https://jjochen.github.io/JJFloatingActionButton/Enums.html Defines the current state of the floating action button. ```Swift @objc public enum JJFloatingActionButtonState : Int ``` -------------------------------- ### circular(withRadius:angleForItem:) Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemLayout.html Static factory that returns a circular layout. The radius is the distance from the button center, and the angleForItem closure calculates each item's angle. ```Swift @objc public static func circular(withRadius radius: CGFloat = 100, angleForItem: @escaping JJItemAngle = JJItemAnimationConfiguration.angleForItem) -> JJItemLayout ``` -------------------------------- ### shadowOffset Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html The shadow offset of the floating action button. Default is `CGSize(width: 0, height: 1)`. ```APIDOC ## shadowOffset ### Description The shadow offset of the floating action button. Default is `CGSize(width: 0, height: 1)`. ### Declaration ```swift @IBInspectable dynamic var shadowOffset: CGSize { get set } ``` ``` -------------------------------- ### itemAnimationConfiguration property declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Declares the itemAnimationConfiguration property, defaulting to JJItemAnimationConfiguration.popUp(). ```swift public var itemAnimationConfiguration: JJItemAnimationConfiguration ``` -------------------------------- ### floatingActionButtonWillClose(_:) Source: https://jjochen.github.io/JJFloatingActionButton/Protocols/JJFloatingActionButtonDelegate.html Called before the closing animation begins. The button state is .closing. ```APIDOC ## floatingActionButtonWillClose(_:) ### Description Called before the closing animation begins. The button state is .closing. ### Declaration ```swift @objc optional func floatingActionButtonWillClose(_ button: JJFloatingActionButton) ``` ### Parameters - **button** (JJFloatingActionButton) - The floating action button that is about to close. ``` -------------------------------- ### Declare JJActionItemTitlePosition enumeration Source: https://jjochen.github.io/JJFloatingActionButton/Enums.html Defines the title position for action items. ```Swift @objc public enum JJActionItemTitlePosition : Int ``` -------------------------------- ### didMoveToSuperview() override declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJActionItem.html Declares the override of didMoveToSuperview() from UIView. ```swift override open func didMoveToSuperview() ``` -------------------------------- ### verticalLine(withInterItemSpacing:firstItemSpacing:) Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemLayout.html Static factory that returns a vertical line layout. Adjust interItemSpacing and firstItemSpacing; when firstItemSpacing is less than or equal to 0, interItemSpacing is used instead. ```Swift @objc public static func verticalLine(withInterItemSpacing interItemSpacing: CGFloat = 12, firstItemSpacing: CGFloat = 0) -> JJItemLayout ``` -------------------------------- ### Display in view controller Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Adds the floating action button to a view controller's view at the trailing bottom corner. ```Swift func display(inViewController viewController: UIViewController, bottomInset: CGFloat = 16, trailingInset: CGFloat = 16, safeAreaInset: CGFloat = 0) ``` -------------------------------- ### close(animated:completion:) Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Closes the floating action button and hides all action items. ```APIDOC ## close(animated:completion:) ### Description Close the floating action button and hide all action items. ### Declaration ```swift func close(animated: Bool = true, completion: (() -> Void)? = nil) ``` ### Parameters - **animated** (Bool) - Optional - When true, button will be close with an animation. Default is `true`. - **completion** (() -> Void)? - Optional - Will be handled upon completion. Default is `nil`. ``` -------------------------------- ### callAction() method declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJActionItem.html Declares the callAction() method that calls the action on the action item. ```swift @objc public func callAction() ``` -------------------------------- ### initialVelocity Property Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJAnimationSettings.html Defines the initial velocity of the animation. The default value is 0.3. This property is not used for transitions. ```swift @objc public var initialVelocity: CGFloat ``` -------------------------------- ### Declare JJCircleView Source: https://jjochen.github.io/JJFloatingActionButton/Classes.html A colored circle with an highlighted state class declaration. ```Swift @objc @IBDesignable public class JJCircleView : UIView ``` -------------------------------- ### buttonImageSize property declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Declares the buttonImageSize property, defaulting to CGSize.zero. If zero, the actual image size is used. ```swift @objc public dynamic var buttonImageSize: CGSize { get set } ``` -------------------------------- ### floatingActionButtonWillClose Delegate Method Source: https://jjochen.github.io/JJFloatingActionButton/Protocols/JJFloatingActionButtonDelegate.html Called before the closing animation begins, with the button state set to .closing. ```swift @objc optional func floatingActionButtonWillClose(_ button: JJFloatingActionButton) ``` -------------------------------- ### isHighlighted Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html A Boolean value indicating whether the action button draws a highlight. ```APIDOC ## isHighlighted ### Description A Boolean value indicating whether the action button draws a highlight. ### Declaration ```swift override open var isHighlighted: Bool { get set } ``` ``` -------------------------------- ### Declare JJFloatingActionButton Source: https://jjochen.github.io/JJFloatingActionButton/Classes.html Floating action button class declaration. ```Swift @objc @IBDesignable public class JJFloatingActionButton : UIControl ``` -------------------------------- ### JJItemAngle Source: https://jjochen.github.io/JJFloatingActionButton/Typealiases.html A typealias representing a closure that calculates the angle for each item in a floating action button. It takes the item index, total number of items, and the action button, and returns the angle in radians. ```APIDOC ## JJItemAngle ### Description A typealias representing a closure that calculates the angle for each item in a floating action button. ### Declaration ```swift public typealias JJItemAngle = (_ index: Int, _ numberOfItems: Int, _ actionButton: JJFloatingActionButton) -> CGFloat ``` ### Parameters - **index** (Int) - The index of the item. - **numberOfItems** (Int) - The total number of items. - **actionButton** (JJFloatingActionButton) - The floating action button. ### Return Value The angle in radians for the specified item. ``` -------------------------------- ### JJItemLayout Class Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJItemLayout.html Public Objective-C compatible class declaration. Defines the JJItemLayout class, subclassing NSObject. ```Swift @objc public class JJItemLayout : NSObject ``` -------------------------------- ### shadowOffset Declaration Source: https://jjochen.github.io/JJFloatingActionButton/Classes/JJFloatingActionButton.html Declares the property for the shadow offset of the floating action button. Default is CGSize(width: 0, height: 1). ```swift @IBInspectable dynamic var shadowOffset: CGSize { get set } ```