RelationInfoUI
How work transitions with relation?
In code
When transitioning from DetailForms to ListForms or DetailForms we need to know the relation name.
In DetailForms transition is prepared in function
open override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
The sender
is the user interface view that trigger the transition.
This sender
must provide the relation name by implementing the protocol RelationInfoUI
If this
sender
is a button (UIButton
) or anyUIControl
then nothing to do, all is already implemented. But for a custom view, like a labrl, you must implement it.
In storyboards
On sender
the relation is added using User Defined Runtimes attributes
Then a segue must be created from detail form to the destination one using storyboard reference
RelationUI code
/// Protocol to provide info on relation
public protocol RelationInfoUI {
/// The relation name
var relationName: String? { get }
/// The relation format
var relationFormat: String? { get }
/// Relation object data.
var relation: Any? { get }
/// Add action to launch segue.
var addRelationSegueAction: Bool { get }
}