-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
169 additions
and
13 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
Sample/Playground.playground/Pages/RedditToast.xcplaygroundpage/Contents.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
//: [Previous](@previous) | ||
|
||
import UIKit | ||
import PlaygroundSupport | ||
import Sejima | ||
|
||
MUToast.appearance().displayDuration = 0 | ||
MUToast.appearance().cornerRadius = 4 | ||
MUToast.appearance().titleColor = .white | ||
MUToast.appearance().backgroundColor = .black | ||
MUToast.appearance().indicatorColor = .red | ||
MUToast.appearance().indicatorWidth = 10 | ||
MUToast.appearance().detailColor = .white | ||
|
||
MUButton.appearance().borderWidth = 2 | ||
MUButton.appearance().cornerRadius = 4.0 | ||
|
||
// Global View | ||
|
||
let vc = UIViewController() | ||
vc.view.backgroundColor = .lightGray | ||
vc.view.frame = CGRect(x: 0, y: 0, width: 375, height: 667) | ||
|
||
let toast = MUToast() | ||
toast.icon = #imageLiteral(resourceName: "reddit") | ||
toast.buttonHeight = 30.0 | ||
toast.spacing = 8 | ||
toast.buttonSpacing = 16 | ||
toast.displayPosition = .bottom | ||
toast.title = "Sorry, can't reach Reddit" | ||
toast.titleFont = .boldSystemFont(ofSize: 18) | ||
toast.detail = "Sorry, can't reach Reddit. Sorry, can't reach Reddit. Sorry, can't reach Reddit. Sorry, can't reach Reddit. Sorry, can't reach Reddit. Sorry, can't reach Reddit. Sorry, can't reach Reddit." | ||
toast.detailFont = .systemFont(ofSize: 14) | ||
toast.show(in: vc, onTap: { | ||
print("toast has been tapped") | ||
}, completion: { dismiss in | ||
print("toast has been dismissed > ", dismiss) | ||
}) | ||
|
||
let cancel = MUButton() | ||
cancel.title = "CANCEL" | ||
cancel.titleFont = .boldSystemFont(ofSize: 14) | ||
cancel.buttonBackgroundColor = .clear | ||
cancel.borderColor = .orange | ||
|
||
let okay = MUButton() | ||
okay.title = "OKAY" | ||
okay.titleFont = .boldSystemFont(ofSize: 14) | ||
okay.buttonBackgroundColor = .red | ||
okay.borderColor = .red | ||
|
||
toast.add(view: cancel) { (button, index) in | ||
print("Button at index \(index) did tap") | ||
} | ||
toast.add(view: okay) { (button, index) in | ||
print("Button at index \(index) did tap") | ||
} | ||
|
||
PlaygroundPage.current.liveView = vc | ||
|
||
//: [Next](@next) |
Binary file added
BIN
+891 Bytes
...e/Playground.playground/Pages/RedditToast.xcplaygroundpage/Resources/reddit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.97 KB
...layground.playground/Pages/RedditToast.xcplaygroundpage/Resources/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.09 KB
...layground.playground/Pages/RedditToast.xcplaygroundpage/Resources/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Sample/Source/Assets.xcassets/reddit.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "reddit.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "[email protected]", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "[email protected]", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters