NatDialogController
public final class NatDialogController : UIViewController
Note
This component is available in the following variants:- ✅ Standard
- ✅ Alert
With the following attributes:
- ✅ Divider
- ✅ Size/width
- ✅ Size/height
- ❌ Scroll
- ❌ Header’s icon buttons
NatDialogController is a class that represents a component from the design system. Its colors change according to the current brand theme.
To create and configure the dialog it’s necessary to use Dialog Builders, which are available as class properties.
Available styles for the dialog:
- Standard
- Alert
Configurable elements for the dialog:
- Title
- Body (Text or custom view)
- Primary button (must be configured before other buttons)
- Secondary button
- Divider
Example of usage:
let dialog = NatDialogController
.standardStyleBuilder
.configure(title: "Title")
.configure(body: "Body")
.configure(divider: true)
.configure(primaryTitle: "Title", primaryAction: { print("Some text") })
.build()
Requires
It’s necessary to configure the Design System with a theme or fatalError will be raised.
DesignSystem().configure(with: AvailableTheme)
-
AlertStyleBuilder is one of the styles available for NatDialogController component.
See moreExample of usage: let dialog = NatDialogController .standardStyleBuilder .configure(...) .build()
Declaration
Swift
public final class AlertStyleBuilder
extension NatDialogController.AlertStyleBuilder: NatDialogBuilder
extension NatDialogController.AlertStyleBuilder: NatDialogTitleConfigurable
extension NatDialogController.AlertStyleBuilder: NatDialogBodyConfigurable
extension NatDialogController.AlertStyleBuilder: NatDialogDismissableConfigurable
extension NatDialogController.AlertStyleBuilder: NatDialogDividerConfigurable
extension NatDialogController.AlertStyleBuilder: NatDialogCompletionHandlerConfigurable
-
StandardStyleBuilder is one of the styles available for NatDialogController component.
See moreExample of usage: let dialog = NatDialogController .standardStyleBuilder .configure(...) .build()
Declaration
Swift
public final class StandardStyleBuilder
extension NatDialogController.StandardStyleBuilder: NatDialogBuilder
extension NatDialogController.StandardStyleBuilder: NatDialogTitleConfigurable
extension NatDialogController.StandardStyleBuilder: NatDialogBodyConfigurable
extension NatDialogController.StandardStyleBuilder: NatDialogCustomBodyConfigurable
extension NatDialogController.StandardStyleBuilder: NatDialogDismissableConfigurable
extension NatDialogController.StandardStyleBuilder: NatDialogDividerConfigurable
extension NatDialogController.StandardStyleBuilder: NatDialogCompletionHandlerConfigurable
-
A view model that is used to set the Dialog’s texts and subviews
Declaration
Swift
public class ViewModel
-
Class property to access StandardStyleBuilder.
Available elements to configure:
- Title
- Body (Text or Custom view)
- Primary Button (must be configured before other buttons)
- Secondary Button (Optional)
Divider
Example of usage:
let dialog = NatDialogController .standardStyleBuilder .configure(title: “Title”) .configure(body: “Body”) .configure(primaryTitle: “Title”, primaryAction: { print(“lol”) }) .build()
Requires
It’s necessary to configure the Design System with a theme or fatalError will be raised.
DesignSystem().configure(with: AvailableTheme)
Declaration
Swift
public static var standardStyleBuilder: StandardStyleBuilder { get }
-
Class property to access AlertStyleBuilder.
Available elements to configure:
- Title
- Body
- Primary Button (must be configured before other buttons)
Secondary Button (Optional)
Example of usage:
let dialog = NatDialogController .alertStyleBuilder .configure(body: “Body”) .configure(primaryTitle: “Title”, primaryAction: { print(“some text”) }) .build()
Requires
It’s necessary to configure the Design System with a theme or fatalError will be raised.
DesignSystem().configure(with: AvailableTheme)
Declaration
Swift
public static var alertStyleBuilder: AlertStyleBuilder { get }