Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
d75d3a76
Commit
d75d3a76
authored
Oct 17, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Marked all chainable dialog methods with @discardableResult
parent
08ec50d1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
Sources/iOS/Dialog.swift
+11
-1
No files found.
Sources/iOS/Dialog.swift
View file @
d75d3a76
...
...
@@ -105,7 +105,7 @@ open class Dialog: NSObject {
super
.
init
()
/// Set callbacks for delegate.
_
=
shouldDismiss
(
handler
:
nil
)
shouldDismiss
(
handler
:
nil
)
.
positive
(
nil
,
handler
:
nil
)
.
negative
(
nil
,
handler
:
nil
)
.
neutral
(
nil
,
handler
:
nil
)
...
...
@@ -119,6 +119,7 @@ open class Dialog: NSObject {
- Parameter _ text: A string.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
title
(
_
text
:
String
?)
->
Dialog
{
dialogView
.
titleLabel
.
text
=
text
return
self
...
...
@@ -129,6 +130,7 @@ open class Dialog: NSObject {
- Parameter _ text: A string.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
details
(
_
text
:
String
?)
->
Dialog
{
dialogView
.
detailsLabel
.
text
=
text
return
self
...
...
@@ -140,6 +142,7 @@ open class Dialog: NSObject {
- Parameter handler: A closure handling tap.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
positive
(
_
title
:
String
?,
handler
:
(()
->
Void
)?)
->
Dialog
{
dialogView
.
positiveButton
.
title
=
title
controller
.
didTapPositiveButtonHandler
=
{
[
unowned
self
]
in
...
...
@@ -155,6 +158,7 @@ open class Dialog: NSObject {
- Parameter handler: A closure handling tap.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
negative
(
_
title
:
String
?,
handler
:
(()
->
Void
)?)
->
Dialog
{
dialogView
.
negativeButton
.
title
=
title
controller
.
didTapNegativeButtonHandler
=
{
[
unowned
self
]
in
...
...
@@ -170,6 +174,7 @@ open class Dialog: NSObject {
- Parameter handler: A closure handling tap.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
neutral
(
_
title
:
String
?,
handler
:
(()
->
Void
)?)
->
Dialog
{
dialogView
.
neutralButton
.
title
=
title
controller
.
didTapNeutralButtonHandler
=
{
[
unowned
self
]
in
...
...
@@ -185,6 +190,7 @@ open class Dialog: NSObject {
- Parameter handler: A closure handling cancellation.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
isCancelable
(
_
value
:
Bool
,
handler
:
(()
->
Void
)?
=
nil
)
->
Dialog
{
controller
.
isCancelable
=
value
controller
.
didCancelHandler
=
{
[
unowned
self
]
in
...
...
@@ -200,6 +206,7 @@ open class Dialog: NSObject {
- Parameter handler: A closure handling if dialog can be dismissed.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
shouldDismiss
(
handler
:
((
DialogView
,
Button
?)
->
Bool
)?)
->
Dialog
{
controller
.
shouldDismissHandler
=
{
[
unowned
self
]
dialogView
,
button
in
let
d
=
self
.
delegate
?
.
dialog
?(
self
,
shouldDismiss
:
button
)
??
true
...
...
@@ -214,6 +221,7 @@ open class Dialog: NSObject {
- Parameter handler: A closure handling the event.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
willAppear
(
handler
:
(()
->
Void
)?)
->
Dialog
{
controller
.
willAppear
=
{
[
unowned
self
]
in
self
.
delegate
?
.
dialogWillAppear
?(
self
)
...
...
@@ -227,6 +235,7 @@ open class Dialog: NSObject {
- Parameter handler: A closure handling the event.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
didDisappear
(
handler
:
(()
->
Void
)?)
->
Dialog
{
controller
.
didDisappear
=
{
[
unowned
self
]
in
self
.
delegate
?
.
dialogDidDisappear
?(
self
)
...
...
@@ -241,6 +250,7 @@ open class Dialog: NSObject {
- Parameter delegate: A DialogDelegate.
- Returns: Dialog itself to allow chaining.
*/
@discardableResult
open
func
delegate
(
_
delegate
:
DialogDelegate
)
->
Dialog
{
self
.
delegate
=
delegate
return
self
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment