Nonstop Swift SDK
Points Widget
How To Use
The points widget can be added using a Storyboard or via code.
To use via a Storyboard, simply include a view in the Storyboard and set its custom class to be NonstopPointsView.
To use via code, create a NonstopPointsView and then add it as a subview to the current view. For example:
let pointsView = NonstopPointsView()
view.addSubview(pointsView)
Additional Attributes
canBeDisabled- (Default value: true) Determines whether the widget will change appearance when the user exceeds their points limit for the day. This should be set to false in the app's menu.isLeftRounded- (Default value: true) Determines whether this side of the widget is rounded or not.isRightRounded- (Default value: true) Determines whether this side of the widget is rounded or not.alignmentDirection- (Default value: center) Determines how the text inside the widget is aligned.messageAlignment- (Default value: bottom) Determines where the dropdown message is displayed relative to the widget. In general, this should either bebottomfor center aligned widgets orleftfor left aligned widgets.dropdownEnabled- (Default value: false) Determines whether the widget will display dropdown messages to the user in certain scenarios.
Methods
showMessage
let pointsView = NonstopPointsView()
pointsView.showMessage()
This function can be used to force the points widget to display the message it most recently received from the server. Note that if no message has been received then no message will be displayed.
removeMessage
let pointsView = NonstopPointsView()
pointsView.removeMessage()
This function can be used to force the points widget to remove the currently visible message it is displaying. Note that if no message is currently displayed this function has no effect. Additionally, it should not be necessary to call this method on a regular basis as the points widget will hide the message in response to changes in its own visible (i.e. if you hide the points widget, the message will also be hidden).