├── .gitignore ├── .swift-version ├── .travis.yml ├── AwaitToast.h ├── AwaitToast.podspec ├── AwaitToast.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── AwaitToast.xcscheme ├── Example ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── await.imageset │ │ ├── Contents.json │ │ └── await.png │ ├── egg.imageset │ │ ├── Contents.json │ │ └── egg.png │ ├── exit.imageset │ │ ├── Contents.json │ │ └── exit.png │ ├── longText.imageset │ │ ├── Contents.json │ │ └── longText.png │ ├── toast.imageset │ │ ├── Contents.json │ │ └── toast.png │ └── trash.imageset │ │ ├── Contents.json │ │ └── trash.png ├── Base.lproj │ └── LaunchScreen.storyboard ├── Info.plist └── Sources │ ├── AppDelegate.swift │ ├── Cells │ ├── ExampleTableViewCell.swift │ └── SettingSwitchTableViewCell.swift │ ├── Enums │ ├── AwaitExampleCellType.swift │ ├── DefaultExampleCellType.swift │ ├── ExampleCellType.swift │ ├── LongTextCellType.swift │ ├── SectionType.swift │ └── SettingCellType.swift │ └── ToastExampleTableViewController.swift ├── Info.plist ├── LICENSE ├── README.md └── Sources └── AwaitToast ├── Appearances ├── DefaultToastAppearance.swift ├── IconToastAppearance.swift ├── ToastAppearance.swift └── ToastAppearanceManager.swift ├── AwaitToast.swift ├── Behaviors ├── AwaitToastBehavior.swift ├── DefaultToastBehavior.swift ├── ToastBehavior.swift └── ToastBehaviorManager.swift ├── Operations ├── AwaitToastOperation.swift ├── DefaultToastOperation.swift ├── ToastDynamicDispatch.swift └── ToastOperation.swift ├── Toast.swift ├── ToastCompatiable.swift ├── ToastDirection.swift ├── Toasts ├── AwaitToastProducer.swift ├── AwaitToastView.swift ├── Default │ ├── AwaitDefault.swift │ ├── AwaitDefaultToastView.swift │ ├── Default.swift │ └── DefaultToastView.swift ├── DefaultToastProducer.swift ├── Icon │ ├── AwaitIcon.swift │ ├── AwaitIconToastView.swift │ ├── Icon.swift │ ├── IconImageLocation.swift │ └── IconToastView.swift └── ToastView.swift └── Utils ├── GlobalConstants.swift └── GlobalFunction.swift /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.xcuserstate 3 | project.xcworkspace/ 4 | xcuserdata/ -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.2 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | osx_image: xcode10.2 2 | language: objective-c 3 | env: 4 | global: 5 | - PROJECT="AwaitToast.xcodeproj" 6 | - IOS_SDK="iphonesimulator" 7 | matrix: 8 | - SDK="$IOS_SDK" DESTINATION="platform=iOS Simulator,OS=12.2,name=iPhone X" 9 | 10 | install: 11 | - swift --version 12 | 13 | before_script: 14 | - set -o pipefail 15 | 16 | script: 17 | - xcodebuild clean build 18 | -project "$PROJECT" 19 | -scheme AwaitToast 20 | -sdk "$SDK" 21 | -destination "$DESTINATION" | xcpretty -c 22 | - xcodebuild clean build 23 | -project "$PROJECT" 24 | -scheme Example 25 | -sdk "$SDK" 26 | -destination "$DESTINATION" | xcpretty -c -------------------------------------------------------------------------------- /AwaitToast.h: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitToast.h 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 03/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for AwaitToast. 12 | FOUNDATION_EXPORT double AwaitToastVersionNumber; 13 | 14 | //! Project version string for AwaitToast. 15 | FOUNDATION_EXPORT const unsigned char AwaitToastVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /AwaitToast.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AwaitToast" 3 | s.version = "1.2.0" 4 | s.summary = "🍞 An async waiting toast with basic toast. Inspired by facebook posting toast." 5 | s.homepage = "https://github.com/k-lpmg/AwaitToast" 6 | s.license = { :type => 'MIT', :file => 'LICENSE' } 7 | s.author = { "DongHee Kang" => "kanglpmg@gmail.com" } 8 | s.source = { :git => "https://github.com/k-lpmg/AwaitToast.git", :tag => s.version.to_s } 9 | s.documentation_url = "https://github.com/k-lpmg/AwaitToast/blob/master/README.md" 10 | 11 | s.ios.source_files = "Sources/**/*.swift" 12 | s.ios.deployment_target = "9.0" 13 | end 14 | -------------------------------------------------------------------------------- /AwaitToast.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 651828472230099A007E54E5 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 6518284622300999007E54E5 /* README.md */; }; 11 | 6518284A22301372007E54E5 /* DefaultExampleCellType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518284922301372007E54E5 /* DefaultExampleCellType.swift */; }; 12 | 6518284C2230137D007E54E5 /* AwaitExampleCellType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518284B2230137D007E54E5 /* AwaitExampleCellType.swift */; }; 13 | 65182877223024A9007E54E5 /* ToastCompatiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182851223024A9007E54E5 /* ToastCompatiable.swift */; }; 14 | 65182878223024A9007E54E5 /* ToastDirection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182852223024A9007E54E5 /* ToastDirection.swift */; }; 15 | 65182879223024A9007E54E5 /* AwaitToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182854223024A9007E54E5 /* AwaitToastView.swift */; }; 16 | 6518287A223024A9007E54E5 /* ToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182855223024A9007E54E5 /* ToastView.swift */; }; 17 | 6518287B223024A9007E54E5 /* AwaitDefault.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182857223024A9007E54E5 /* AwaitDefault.swift */; }; 18 | 6518287C223024A9007E54E5 /* Default.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182858223024A9007E54E5 /* Default.swift */; }; 19 | 6518287D223024A9007E54E5 /* DefaultToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182859223024A9007E54E5 /* DefaultToastView.swift */; }; 20 | 6518287E223024A9007E54E5 /* AwaitDefaultToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518285A223024A9007E54E5 /* AwaitDefaultToastView.swift */; }; 21 | 6518287F223024A9007E54E5 /* AwaitToastProducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518285B223024A9007E54E5 /* AwaitToastProducer.swift */; }; 22 | 65182880223024A9007E54E5 /* IconImageLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518285D223024A9007E54E5 /* IconImageLocation.swift */; }; 23 | 65182881223024A9007E54E5 /* Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518285E223024A9007E54E5 /* Icon.swift */; }; 24 | 65182882223024A9007E54E5 /* IconToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518285F223024A9007E54E5 /* IconToastView.swift */; }; 25 | 65182883223024A9007E54E5 /* AwaitIconToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182860223024A9007E54E5 /* AwaitIconToastView.swift */; }; 26 | 65182884223024A9007E54E5 /* AwaitIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182861223024A9007E54E5 /* AwaitIcon.swift */; }; 27 | 65182885223024A9007E54E5 /* DefaultToastProducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182862223024A9007E54E5 /* DefaultToastProducer.swift */; }; 28 | 65182886223024A9007E54E5 /* AwaitToast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182863223024A9007E54E5 /* AwaitToast.swift */; }; 29 | 65182887223024A9007E54E5 /* GlobalFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182865223024A9007E54E5 /* GlobalFunction.swift */; }; 30 | 65182888223024A9007E54E5 /* ToastOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182867223024A9007E54E5 /* ToastOperation.swift */; }; 31 | 65182889223024A9007E54E5 /* DefaultToastOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182868223024A9007E54E5 /* DefaultToastOperation.swift */; }; 32 | 6518288B223024A9007E54E5 /* ToastDynamicDispatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518286A223024A9007E54E5 /* ToastDynamicDispatch.swift */; }; 33 | 6518288C223024A9007E54E5 /* AwaitToastOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518286B223024A9007E54E5 /* AwaitToastOperation.swift */; }; 34 | 6518288D223024A9007E54E5 /* DefaultToastBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518286D223024A9007E54E5 /* DefaultToastBehavior.swift */; }; 35 | 6518288E223024A9007E54E5 /* ToastBehaviorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518286E223024A9007E54E5 /* ToastBehaviorManager.swift */; }; 36 | 6518288F223024A9007E54E5 /* AwaitToastBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6518286F223024A9007E54E5 /* AwaitToastBehavior.swift */; }; 37 | 65182890223024A9007E54E5 /* ToastBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182870223024A9007E54E5 /* ToastBehavior.swift */; }; 38 | 65182891223024A9007E54E5 /* DefaultToastAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182872223024A9007E54E5 /* DefaultToastAppearance.swift */; }; 39 | 65182892223024A9007E54E5 /* IconToastAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182873223024A9007E54E5 /* IconToastAppearance.swift */; }; 40 | 65182893223024A9007E54E5 /* ToastAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182874223024A9007E54E5 /* ToastAppearance.swift */; }; 41 | 65182894223024A9007E54E5 /* ToastAppearanceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182875223024A9007E54E5 /* ToastAppearanceManager.swift */; }; 42 | 65182895223024A9007E54E5 /* Toast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65182876223024A9007E54E5 /* Toast.swift */; }; 43 | 659E38F9222BA21A00062BDE /* AwaitToast.h in Headers */ = {isa = PBXBuildFile; fileRef = 659E38F7222BA21A00062BDE /* AwaitToast.h */; settings = {ATTRIBUTES = (Public, ); }; }; 44 | 659E3950222BA27800062BDE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 659E394F222BA27800062BDE /* Assets.xcassets */; }; 45 | 659E3953222BA27800062BDE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 659E3951222BA27800062BDE /* LaunchScreen.storyboard */; }; 46 | 65DDDD53222D50140076118E /* AwaitToast.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659E38F4222BA21A00062BDE /* AwaitToast.framework */; }; 47 | 65DDDD54222D50140076118E /* AwaitToast.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 659E38F4222BA21A00062BDE /* AwaitToast.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 48 | 65F146752251CB5C00F7CFF6 /* LongTextCellType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F146742251CB5C00F7CFF6 /* LongTextCellType.swift */; }; 49 | 65F1467A2251D47E00F7CFF6 /* GlobalConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F146792251D47E00F7CFF6 /* GlobalConstants.swift */; }; 50 | 65FB9951222C40D300A75E8A /* ToastExampleTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FB994C222C40D300A75E8A /* ToastExampleTableViewController.swift */; }; 51 | 65FB9952222C40D300A75E8A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FB994D222C40D300A75E8A /* AppDelegate.swift */; }; 52 | 65FB995F222C412300A75E8A /* SettingCellType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FB995C222C412300A75E8A /* SettingCellType.swift */; }; 53 | 65FB9960222C412300A75E8A /* ExampleCellType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FB995D222C412300A75E8A /* ExampleCellType.swift */; }; 54 | 65FB9963222C41A900A75E8A /* SectionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FB9962222C41A900A75E8A /* SectionType.swift */; }; 55 | 65FB9965222C427B00A75E8A /* ExampleTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FB9964222C427B00A75E8A /* ExampleTableViewCell.swift */; }; 56 | 65FB9969222C438100A75E8A /* SettingSwitchTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FB9968222C438100A75E8A /* SettingSwitchTableViewCell.swift */; }; 57 | /* End PBXBuildFile section */ 58 | 59 | /* Begin PBXContainerItemProxy section */ 60 | 65DDDD55222D50140076118E /* PBXContainerItemProxy */ = { 61 | isa = PBXContainerItemProxy; 62 | containerPortal = 659E38EB222BA21A00062BDE /* Project object */; 63 | proxyType = 1; 64 | remoteGlobalIDString = 659E38F3222BA21A00062BDE; 65 | remoteInfo = AwaitToast; 66 | }; 67 | /* End PBXContainerItemProxy section */ 68 | 69 | /* Begin PBXCopyFilesBuildPhase section */ 70 | 65DDDD57222D50140076118E /* Embed Frameworks */ = { 71 | isa = PBXCopyFilesBuildPhase; 72 | buildActionMask = 2147483647; 73 | dstPath = ""; 74 | dstSubfolderSpec = 10; 75 | files = ( 76 | 65DDDD54222D50140076118E /* AwaitToast.framework in Embed Frameworks */, 77 | ); 78 | name = "Embed Frameworks"; 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXCopyFilesBuildPhase section */ 82 | 83 | /* Begin PBXFileReference section */ 84 | 6518284622300999007E54E5 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 85 | 6518284922301372007E54E5 /* DefaultExampleCellType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultExampleCellType.swift; sourceTree = ""; }; 86 | 6518284B2230137D007E54E5 /* AwaitExampleCellType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AwaitExampleCellType.swift; sourceTree = ""; }; 87 | 65182851223024A9007E54E5 /* ToastCompatiable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastCompatiable.swift; sourceTree = ""; }; 88 | 65182852223024A9007E54E5 /* ToastDirection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastDirection.swift; sourceTree = ""; }; 89 | 65182854223024A9007E54E5 /* AwaitToastView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwaitToastView.swift; sourceTree = ""; }; 90 | 65182855223024A9007E54E5 /* ToastView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastView.swift; sourceTree = ""; }; 91 | 65182857223024A9007E54E5 /* AwaitDefault.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwaitDefault.swift; sourceTree = ""; }; 92 | 65182858223024A9007E54E5 /* Default.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Default.swift; sourceTree = ""; }; 93 | 65182859223024A9007E54E5 /* DefaultToastView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultToastView.swift; sourceTree = ""; }; 94 | 6518285A223024A9007E54E5 /* AwaitDefaultToastView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwaitDefaultToastView.swift; sourceTree = ""; }; 95 | 6518285B223024A9007E54E5 /* AwaitToastProducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwaitToastProducer.swift; sourceTree = ""; }; 96 | 6518285D223024A9007E54E5 /* IconImageLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IconImageLocation.swift; sourceTree = ""; }; 97 | 6518285E223024A9007E54E5 /* Icon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Icon.swift; sourceTree = ""; }; 98 | 6518285F223024A9007E54E5 /* IconToastView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IconToastView.swift; sourceTree = ""; }; 99 | 65182860223024A9007E54E5 /* AwaitIconToastView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwaitIconToastView.swift; sourceTree = ""; }; 100 | 65182861223024A9007E54E5 /* AwaitIcon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwaitIcon.swift; sourceTree = ""; }; 101 | 65182862223024A9007E54E5 /* DefaultToastProducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultToastProducer.swift; sourceTree = ""; }; 102 | 65182863223024A9007E54E5 /* AwaitToast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwaitToast.swift; sourceTree = ""; }; 103 | 65182865223024A9007E54E5 /* GlobalFunction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlobalFunction.swift; sourceTree = ""; }; 104 | 65182867223024A9007E54E5 /* ToastOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastOperation.swift; sourceTree = ""; }; 105 | 65182868223024A9007E54E5 /* DefaultToastOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultToastOperation.swift; sourceTree = ""; }; 106 | 6518286A223024A9007E54E5 /* ToastDynamicDispatch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastDynamicDispatch.swift; sourceTree = ""; }; 107 | 6518286B223024A9007E54E5 /* AwaitToastOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwaitToastOperation.swift; sourceTree = ""; }; 108 | 6518286D223024A9007E54E5 /* DefaultToastBehavior.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultToastBehavior.swift; sourceTree = ""; }; 109 | 6518286E223024A9007E54E5 /* ToastBehaviorManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastBehaviorManager.swift; sourceTree = ""; }; 110 | 6518286F223024A9007E54E5 /* AwaitToastBehavior.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwaitToastBehavior.swift; sourceTree = ""; }; 111 | 65182870223024A9007E54E5 /* ToastBehavior.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastBehavior.swift; sourceTree = ""; }; 112 | 65182872223024A9007E54E5 /* DefaultToastAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultToastAppearance.swift; sourceTree = ""; }; 113 | 65182873223024A9007E54E5 /* IconToastAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IconToastAppearance.swift; sourceTree = ""; }; 114 | 65182874223024A9007E54E5 /* ToastAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastAppearance.swift; sourceTree = ""; }; 115 | 65182875223024A9007E54E5 /* ToastAppearanceManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastAppearanceManager.swift; sourceTree = ""; }; 116 | 65182876223024A9007E54E5 /* Toast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Toast.swift; sourceTree = ""; }; 117 | 659E38F4222BA21A00062BDE /* AwaitToast.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AwaitToast.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 118 | 659E38F7222BA21A00062BDE /* AwaitToast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AwaitToast.h; sourceTree = ""; }; 119 | 659E38F8222BA21A00062BDE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 120 | 659E3946222BA27700062BDE /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 121 | 659E394F222BA27800062BDE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 122 | 659E3952222BA27800062BDE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 123 | 659E3954222BA27800062BDE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 124 | 65F146742251CB5C00F7CFF6 /* LongTextCellType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LongTextCellType.swift; sourceTree = ""; }; 125 | 65F146792251D47E00F7CFF6 /* GlobalConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalConstants.swift; sourceTree = ""; }; 126 | 65FB994C222C40D300A75E8A /* ToastExampleTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastExampleTableViewController.swift; sourceTree = ""; }; 127 | 65FB994D222C40D300A75E8A /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 128 | 65FB995C222C412300A75E8A /* SettingCellType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingCellType.swift; sourceTree = ""; }; 129 | 65FB995D222C412300A75E8A /* ExampleCellType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleCellType.swift; sourceTree = ""; }; 130 | 65FB9962222C41A900A75E8A /* SectionType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionType.swift; sourceTree = ""; }; 131 | 65FB9964222C427B00A75E8A /* ExampleTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleTableViewCell.swift; sourceTree = ""; }; 132 | 65FB9968222C438100A75E8A /* SettingSwitchTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingSwitchTableViewCell.swift; sourceTree = ""; }; 133 | /* End PBXFileReference section */ 134 | 135 | /* Begin PBXFrameworksBuildPhase section */ 136 | 659E38F1222BA21A00062BDE /* Frameworks */ = { 137 | isa = PBXFrameworksBuildPhase; 138 | buildActionMask = 2147483647; 139 | files = ( 140 | ); 141 | runOnlyForDeploymentPostprocessing = 0; 142 | }; 143 | 659E3943222BA27700062BDE /* Frameworks */ = { 144 | isa = PBXFrameworksBuildPhase; 145 | buildActionMask = 2147483647; 146 | files = ( 147 | 65DDDD53222D50140076118E /* AwaitToast.framework in Frameworks */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXFrameworksBuildPhase section */ 152 | 153 | /* Begin PBXGroup section */ 154 | 651828482230135B007E54E5 /* Enums */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 6518284B2230137D007E54E5 /* AwaitExampleCellType.swift */, 158 | 6518284922301372007E54E5 /* DefaultExampleCellType.swift */, 159 | 65FB995D222C412300A75E8A /* ExampleCellType.swift */, 160 | 65F146742251CB5C00F7CFF6 /* LongTextCellType.swift */, 161 | 65FB9962222C41A900A75E8A /* SectionType.swift */, 162 | 65FB995C222C412300A75E8A /* SettingCellType.swift */, 163 | ); 164 | path = Enums; 165 | sourceTree = ""; 166 | }; 167 | 6518284F223024A9007E54E5 /* Sources */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 65182850223024A9007E54E5 /* AwaitToast */, 171 | ); 172 | path = Sources; 173 | sourceTree = ""; 174 | }; 175 | 65182850223024A9007E54E5 /* AwaitToast */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 65182863223024A9007E54E5 /* AwaitToast.swift */, 179 | 65182876223024A9007E54E5 /* Toast.swift */, 180 | 65182851223024A9007E54E5 /* ToastCompatiable.swift */, 181 | 65182852223024A9007E54E5 /* ToastDirection.swift */, 182 | 65182871223024A9007E54E5 /* Appearances */, 183 | 6518286C223024A9007E54E5 /* Behaviors */, 184 | 65182866223024A9007E54E5 /* Operations */, 185 | 65182853223024A9007E54E5 /* Toasts */, 186 | 65182864223024A9007E54E5 /* Utils */, 187 | ); 188 | path = AwaitToast; 189 | sourceTree = ""; 190 | }; 191 | 65182853223024A9007E54E5 /* Toasts */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | 6518285B223024A9007E54E5 /* AwaitToastProducer.swift */, 195 | 65182854223024A9007E54E5 /* AwaitToastView.swift */, 196 | 65182862223024A9007E54E5 /* DefaultToastProducer.swift */, 197 | 65182855223024A9007E54E5 /* ToastView.swift */, 198 | 65182856223024A9007E54E5 /* Default */, 199 | 6518285C223024A9007E54E5 /* Icon */, 200 | ); 201 | path = Toasts; 202 | sourceTree = ""; 203 | }; 204 | 65182856223024A9007E54E5 /* Default */ = { 205 | isa = PBXGroup; 206 | children = ( 207 | 65182857223024A9007E54E5 /* AwaitDefault.swift */, 208 | 6518285A223024A9007E54E5 /* AwaitDefaultToastView.swift */, 209 | 65182858223024A9007E54E5 /* Default.swift */, 210 | 65182859223024A9007E54E5 /* DefaultToastView.swift */, 211 | ); 212 | path = Default; 213 | sourceTree = ""; 214 | }; 215 | 6518285C223024A9007E54E5 /* Icon */ = { 216 | isa = PBXGroup; 217 | children = ( 218 | 65182861223024A9007E54E5 /* AwaitIcon.swift */, 219 | 65182860223024A9007E54E5 /* AwaitIconToastView.swift */, 220 | 6518285E223024A9007E54E5 /* Icon.swift */, 221 | 6518285D223024A9007E54E5 /* IconImageLocation.swift */, 222 | 6518285F223024A9007E54E5 /* IconToastView.swift */, 223 | ); 224 | path = Icon; 225 | sourceTree = ""; 226 | }; 227 | 65182864223024A9007E54E5 /* Utils */ = { 228 | isa = PBXGroup; 229 | children = ( 230 | 65182865223024A9007E54E5 /* GlobalFunction.swift */, 231 | 65F146792251D47E00F7CFF6 /* GlobalConstants.swift */, 232 | ); 233 | path = Utils; 234 | sourceTree = ""; 235 | }; 236 | 65182866223024A9007E54E5 /* Operations */ = { 237 | isa = PBXGroup; 238 | children = ( 239 | 6518286B223024A9007E54E5 /* AwaitToastOperation.swift */, 240 | 65182868223024A9007E54E5 /* DefaultToastOperation.swift */, 241 | 6518286A223024A9007E54E5 /* ToastDynamicDispatch.swift */, 242 | 65182867223024A9007E54E5 /* ToastOperation.swift */, 243 | ); 244 | path = Operations; 245 | sourceTree = ""; 246 | }; 247 | 6518286C223024A9007E54E5 /* Behaviors */ = { 248 | isa = PBXGroup; 249 | children = ( 250 | 6518286F223024A9007E54E5 /* AwaitToastBehavior.swift */, 251 | 6518286D223024A9007E54E5 /* DefaultToastBehavior.swift */, 252 | 65182870223024A9007E54E5 /* ToastBehavior.swift */, 253 | 6518286E223024A9007E54E5 /* ToastBehaviorManager.swift */, 254 | ); 255 | path = Behaviors; 256 | sourceTree = ""; 257 | }; 258 | 65182871223024A9007E54E5 /* Appearances */ = { 259 | isa = PBXGroup; 260 | children = ( 261 | 65182872223024A9007E54E5 /* DefaultToastAppearance.swift */, 262 | 65182873223024A9007E54E5 /* IconToastAppearance.swift */, 263 | 65182874223024A9007E54E5 /* ToastAppearance.swift */, 264 | 65182875223024A9007E54E5 /* ToastAppearanceManager.swift */, 265 | ); 266 | path = Appearances; 267 | sourceTree = ""; 268 | }; 269 | 659E38EA222BA21A00062BDE = { 270 | isa = PBXGroup; 271 | children = ( 272 | 659E38F7222BA21A00062BDE /* AwaitToast.h */, 273 | 6518284622300999007E54E5 /* README.md */, 274 | 659E38F8222BA21A00062BDE /* Info.plist */, 275 | 6518284F223024A9007E54E5 /* Sources */, 276 | 659E3947222BA27700062BDE /* Example */, 277 | 659E38F5222BA21A00062BDE /* Products */, 278 | ); 279 | sourceTree = ""; 280 | }; 281 | 659E38F5222BA21A00062BDE /* Products */ = { 282 | isa = PBXGroup; 283 | children = ( 284 | 659E38F4222BA21A00062BDE /* AwaitToast.framework */, 285 | 659E3946222BA27700062BDE /* Example.app */, 286 | ); 287 | name = Products; 288 | sourceTree = ""; 289 | }; 290 | 659E3947222BA27700062BDE /* Example */ = { 291 | isa = PBXGroup; 292 | children = ( 293 | 65FB9949222C40D300A75E8A /* Sources */, 294 | 659E3954222BA27800062BDE /* Info.plist */, 295 | 659E394F222BA27800062BDE /* Assets.xcassets */, 296 | 659E3951222BA27800062BDE /* LaunchScreen.storyboard */, 297 | ); 298 | path = Example; 299 | sourceTree = ""; 300 | }; 301 | 65FB9949222C40D300A75E8A /* Sources */ = { 302 | isa = PBXGroup; 303 | children = ( 304 | 651828482230135B007E54E5 /* Enums */, 305 | 65FB995B222C412300A75E8A /* Cells */, 306 | 65FB994D222C40D300A75E8A /* AppDelegate.swift */, 307 | 65FB994C222C40D300A75E8A /* ToastExampleTableViewController.swift */, 308 | ); 309 | path = Sources; 310 | sourceTree = ""; 311 | }; 312 | 65FB995B222C412300A75E8A /* Cells */ = { 313 | isa = PBXGroup; 314 | children = ( 315 | 65FB9964222C427B00A75E8A /* ExampleTableViewCell.swift */, 316 | 65FB9968222C438100A75E8A /* SettingSwitchTableViewCell.swift */, 317 | ); 318 | path = Cells; 319 | sourceTree = ""; 320 | }; 321 | /* End PBXGroup section */ 322 | 323 | /* Begin PBXHeadersBuildPhase section */ 324 | 659E38EF222BA21A00062BDE /* Headers */ = { 325 | isa = PBXHeadersBuildPhase; 326 | buildActionMask = 2147483647; 327 | files = ( 328 | 659E38F9222BA21A00062BDE /* AwaitToast.h in Headers */, 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | }; 332 | /* End PBXHeadersBuildPhase section */ 333 | 334 | /* Begin PBXNativeTarget section */ 335 | 659E38F3222BA21A00062BDE /* AwaitToast */ = { 336 | isa = PBXNativeTarget; 337 | buildConfigurationList = 659E38FC222BA21A00062BDE /* Build configuration list for PBXNativeTarget "AwaitToast" */; 338 | buildPhases = ( 339 | 659E38EF222BA21A00062BDE /* Headers */, 340 | 659E38F0222BA21A00062BDE /* Sources */, 341 | 659E38F1222BA21A00062BDE /* Frameworks */, 342 | 659E38F2222BA21A00062BDE /* Resources */, 343 | ); 344 | buildRules = ( 345 | ); 346 | dependencies = ( 347 | ); 348 | name = AwaitToast; 349 | productName = AwaitToast; 350 | productReference = 659E38F4222BA21A00062BDE /* AwaitToast.framework */; 351 | productType = "com.apple.product-type.framework"; 352 | }; 353 | 659E3945222BA27700062BDE /* Example */ = { 354 | isa = PBXNativeTarget; 355 | buildConfigurationList = 659E3955222BA27800062BDE /* Build configuration list for PBXNativeTarget "Example" */; 356 | buildPhases = ( 357 | 659E3942222BA27700062BDE /* Sources */, 358 | 659E3943222BA27700062BDE /* Frameworks */, 359 | 659E3944222BA27700062BDE /* Resources */, 360 | 65DDDD57222D50140076118E /* Embed Frameworks */, 361 | ); 362 | buildRules = ( 363 | ); 364 | dependencies = ( 365 | 65DDDD56222D50140076118E /* PBXTargetDependency */, 366 | ); 367 | name = Example; 368 | productName = Example; 369 | productReference = 659E3946222BA27700062BDE /* Example.app */; 370 | productType = "com.apple.product-type.application"; 371 | }; 372 | /* End PBXNativeTarget section */ 373 | 374 | /* Begin PBXProject section */ 375 | 659E38EB222BA21A00062BDE /* Project object */ = { 376 | isa = PBXProject; 377 | attributes = { 378 | LastSwiftUpdateCheck = 1010; 379 | LastUpgradeCheck = 1010; 380 | ORGANIZATIONNAME = "k-lpmg"; 381 | TargetAttributes = { 382 | 659E38F3222BA21A00062BDE = { 383 | CreatedOnToolsVersion = 10.1; 384 | }; 385 | 659E3945222BA27700062BDE = { 386 | CreatedOnToolsVersion = 10.1; 387 | LastSwiftMigration = 1010; 388 | }; 389 | }; 390 | }; 391 | buildConfigurationList = 659E38EE222BA21A00062BDE /* Build configuration list for PBXProject "AwaitToast" */; 392 | compatibilityVersion = "Xcode 9.3"; 393 | developmentRegion = en; 394 | hasScannedForEncodings = 0; 395 | knownRegions = ( 396 | en, 397 | Base, 398 | ); 399 | mainGroup = 659E38EA222BA21A00062BDE; 400 | productRefGroup = 659E38F5222BA21A00062BDE /* Products */; 401 | projectDirPath = ""; 402 | projectRoot = ""; 403 | targets = ( 404 | 659E38F3222BA21A00062BDE /* AwaitToast */, 405 | 659E3945222BA27700062BDE /* Example */, 406 | ); 407 | }; 408 | /* End PBXProject section */ 409 | 410 | /* Begin PBXResourcesBuildPhase section */ 411 | 659E38F2222BA21A00062BDE /* Resources */ = { 412 | isa = PBXResourcesBuildPhase; 413 | buildActionMask = 2147483647; 414 | files = ( 415 | 651828472230099A007E54E5 /* README.md in Resources */, 416 | ); 417 | runOnlyForDeploymentPostprocessing = 0; 418 | }; 419 | 659E3944222BA27700062BDE /* Resources */ = { 420 | isa = PBXResourcesBuildPhase; 421 | buildActionMask = 2147483647; 422 | files = ( 423 | 659E3953222BA27800062BDE /* LaunchScreen.storyboard in Resources */, 424 | 659E3950222BA27800062BDE /* Assets.xcassets in Resources */, 425 | ); 426 | runOnlyForDeploymentPostprocessing = 0; 427 | }; 428 | /* End PBXResourcesBuildPhase section */ 429 | 430 | /* Begin PBXSourcesBuildPhase section */ 431 | 659E38F0222BA21A00062BDE /* Sources */ = { 432 | isa = PBXSourcesBuildPhase; 433 | buildActionMask = 2147483647; 434 | files = ( 435 | 6518287A223024A9007E54E5 /* ToastView.swift in Sources */, 436 | 65182887223024A9007E54E5 /* GlobalFunction.swift in Sources */, 437 | 65182885223024A9007E54E5 /* DefaultToastProducer.swift in Sources */, 438 | 6518287C223024A9007E54E5 /* Default.swift in Sources */, 439 | 65182893223024A9007E54E5 /* ToastAppearance.swift in Sources */, 440 | 65182883223024A9007E54E5 /* AwaitIconToastView.swift in Sources */, 441 | 65182877223024A9007E54E5 /* ToastCompatiable.swift in Sources */, 442 | 6518287B223024A9007E54E5 /* AwaitDefault.swift in Sources */, 443 | 6518287F223024A9007E54E5 /* AwaitToastProducer.swift in Sources */, 444 | 6518288D223024A9007E54E5 /* DefaultToastBehavior.swift in Sources */, 445 | 6518288F223024A9007E54E5 /* AwaitToastBehavior.swift in Sources */, 446 | 65182895223024A9007E54E5 /* Toast.swift in Sources */, 447 | 65182880223024A9007E54E5 /* IconImageLocation.swift in Sources */, 448 | 6518287D223024A9007E54E5 /* DefaultToastView.swift in Sources */, 449 | 65182892223024A9007E54E5 /* IconToastAppearance.swift in Sources */, 450 | 65182891223024A9007E54E5 /* DefaultToastAppearance.swift in Sources */, 451 | 65182878223024A9007E54E5 /* ToastDirection.swift in Sources */, 452 | 65182879223024A9007E54E5 /* AwaitToastView.swift in Sources */, 453 | 65182894223024A9007E54E5 /* ToastAppearanceManager.swift in Sources */, 454 | 6518288C223024A9007E54E5 /* AwaitToastOperation.swift in Sources */, 455 | 65182882223024A9007E54E5 /* IconToastView.swift in Sources */, 456 | 6518288B223024A9007E54E5 /* ToastDynamicDispatch.swift in Sources */, 457 | 65182889223024A9007E54E5 /* DefaultToastOperation.swift in Sources */, 458 | 65182886223024A9007E54E5 /* AwaitToast.swift in Sources */, 459 | 65182890223024A9007E54E5 /* ToastBehavior.swift in Sources */, 460 | 6518287E223024A9007E54E5 /* AwaitDefaultToastView.swift in Sources */, 461 | 6518288E223024A9007E54E5 /* ToastBehaviorManager.swift in Sources */, 462 | 65182888223024A9007E54E5 /* ToastOperation.swift in Sources */, 463 | 65182881223024A9007E54E5 /* Icon.swift in Sources */, 464 | 65F1467A2251D47E00F7CFF6 /* GlobalConstants.swift in Sources */, 465 | 65182884223024A9007E54E5 /* AwaitIcon.swift in Sources */, 466 | ); 467 | runOnlyForDeploymentPostprocessing = 0; 468 | }; 469 | 659E3942222BA27700062BDE /* Sources */ = { 470 | isa = PBXSourcesBuildPhase; 471 | buildActionMask = 2147483647; 472 | files = ( 473 | 65FB9952222C40D300A75E8A /* AppDelegate.swift in Sources */, 474 | 65FB995F222C412300A75E8A /* SettingCellType.swift in Sources */, 475 | 65F146752251CB5C00F7CFF6 /* LongTextCellType.swift in Sources */, 476 | 6518284C2230137D007E54E5 /* AwaitExampleCellType.swift in Sources */, 477 | 6518284A22301372007E54E5 /* DefaultExampleCellType.swift in Sources */, 478 | 65FB9969222C438100A75E8A /* SettingSwitchTableViewCell.swift in Sources */, 479 | 65FB9965222C427B00A75E8A /* ExampleTableViewCell.swift in Sources */, 480 | 65FB9960222C412300A75E8A /* ExampleCellType.swift in Sources */, 481 | 65FB9951222C40D300A75E8A /* ToastExampleTableViewController.swift in Sources */, 482 | 65FB9963222C41A900A75E8A /* SectionType.swift in Sources */, 483 | ); 484 | runOnlyForDeploymentPostprocessing = 0; 485 | }; 486 | /* End PBXSourcesBuildPhase section */ 487 | 488 | /* Begin PBXTargetDependency section */ 489 | 65DDDD56222D50140076118E /* PBXTargetDependency */ = { 490 | isa = PBXTargetDependency; 491 | target = 659E38F3222BA21A00062BDE /* AwaitToast */; 492 | targetProxy = 65DDDD55222D50140076118E /* PBXContainerItemProxy */; 493 | }; 494 | /* End PBXTargetDependency section */ 495 | 496 | /* Begin PBXVariantGroup section */ 497 | 659E3951222BA27800062BDE /* LaunchScreen.storyboard */ = { 498 | isa = PBXVariantGroup; 499 | children = ( 500 | 659E3952222BA27800062BDE /* Base */, 501 | ); 502 | name = LaunchScreen.storyboard; 503 | sourceTree = ""; 504 | }; 505 | /* End PBXVariantGroup section */ 506 | 507 | /* Begin XCBuildConfiguration section */ 508 | 659E38FA222BA21A00062BDE /* Debug */ = { 509 | isa = XCBuildConfiguration; 510 | buildSettings = { 511 | ALWAYS_SEARCH_USER_PATHS = NO; 512 | CLANG_ANALYZER_NONNULL = YES; 513 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 514 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 515 | CLANG_CXX_LIBRARY = "libc++"; 516 | CLANG_ENABLE_MODULES = YES; 517 | CLANG_ENABLE_OBJC_ARC = YES; 518 | CLANG_ENABLE_OBJC_WEAK = YES; 519 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 520 | CLANG_WARN_BOOL_CONVERSION = YES; 521 | CLANG_WARN_COMMA = YES; 522 | CLANG_WARN_CONSTANT_CONVERSION = YES; 523 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 524 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 525 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 526 | CLANG_WARN_EMPTY_BODY = YES; 527 | CLANG_WARN_ENUM_CONVERSION = YES; 528 | CLANG_WARN_INFINITE_RECURSION = YES; 529 | CLANG_WARN_INT_CONVERSION = YES; 530 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 531 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 532 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 533 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 534 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 535 | CLANG_WARN_STRICT_PROTOTYPES = YES; 536 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 537 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 538 | CLANG_WARN_UNREACHABLE_CODE = YES; 539 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 540 | CODE_SIGN_IDENTITY = "iPhone Developer"; 541 | COPY_PHASE_STRIP = NO; 542 | CURRENT_PROJECT_VERSION = 1; 543 | DEBUG_INFORMATION_FORMAT = dwarf; 544 | ENABLE_STRICT_OBJC_MSGSEND = YES; 545 | ENABLE_TESTABILITY = YES; 546 | GCC_C_LANGUAGE_STANDARD = gnu11; 547 | GCC_DYNAMIC_NO_PIC = NO; 548 | GCC_NO_COMMON_BLOCKS = YES; 549 | GCC_OPTIMIZATION_LEVEL = 0; 550 | GCC_PREPROCESSOR_DEFINITIONS = ( 551 | "DEBUG=1", 552 | "$(inherited)", 553 | ); 554 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 555 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 556 | GCC_WARN_UNDECLARED_SELECTOR = YES; 557 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 558 | GCC_WARN_UNUSED_FUNCTION = YES; 559 | GCC_WARN_UNUSED_VARIABLE = YES; 560 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 561 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 562 | MTL_FAST_MATH = YES; 563 | ONLY_ACTIVE_ARCH = YES; 564 | SDKROOT = iphoneos; 565 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 566 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 567 | VERSIONING_SYSTEM = "apple-generic"; 568 | VERSION_INFO_PREFIX = ""; 569 | }; 570 | name = Debug; 571 | }; 572 | 659E38FB222BA21A00062BDE /* Release */ = { 573 | isa = XCBuildConfiguration; 574 | buildSettings = { 575 | ALWAYS_SEARCH_USER_PATHS = NO; 576 | CLANG_ANALYZER_NONNULL = YES; 577 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 578 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 579 | CLANG_CXX_LIBRARY = "libc++"; 580 | CLANG_ENABLE_MODULES = YES; 581 | CLANG_ENABLE_OBJC_ARC = YES; 582 | CLANG_ENABLE_OBJC_WEAK = YES; 583 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 584 | CLANG_WARN_BOOL_CONVERSION = YES; 585 | CLANG_WARN_COMMA = YES; 586 | CLANG_WARN_CONSTANT_CONVERSION = YES; 587 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 588 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 589 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 590 | CLANG_WARN_EMPTY_BODY = YES; 591 | CLANG_WARN_ENUM_CONVERSION = YES; 592 | CLANG_WARN_INFINITE_RECURSION = YES; 593 | CLANG_WARN_INT_CONVERSION = YES; 594 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 595 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 596 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 597 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 598 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 599 | CLANG_WARN_STRICT_PROTOTYPES = YES; 600 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 601 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 602 | CLANG_WARN_UNREACHABLE_CODE = YES; 603 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 604 | CODE_SIGN_IDENTITY = "iPhone Developer"; 605 | COPY_PHASE_STRIP = NO; 606 | CURRENT_PROJECT_VERSION = 1; 607 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 608 | ENABLE_NS_ASSERTIONS = NO; 609 | ENABLE_STRICT_OBJC_MSGSEND = YES; 610 | GCC_C_LANGUAGE_STANDARD = gnu11; 611 | GCC_NO_COMMON_BLOCKS = YES; 612 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 613 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 614 | GCC_WARN_UNDECLARED_SELECTOR = YES; 615 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 616 | GCC_WARN_UNUSED_FUNCTION = YES; 617 | GCC_WARN_UNUSED_VARIABLE = YES; 618 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 619 | MTL_ENABLE_DEBUG_INFO = NO; 620 | MTL_FAST_MATH = YES; 621 | SDKROOT = iphoneos; 622 | SWIFT_COMPILATION_MODE = wholemodule; 623 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 624 | VALIDATE_PRODUCT = YES; 625 | VERSIONING_SYSTEM = "apple-generic"; 626 | VERSION_INFO_PREFIX = ""; 627 | }; 628 | name = Release; 629 | }; 630 | 659E38FD222BA21A00062BDE /* Debug */ = { 631 | isa = XCBuildConfiguration; 632 | buildSettings = { 633 | CODE_SIGN_IDENTITY = ""; 634 | CODE_SIGN_STYLE = Manual; 635 | DEFINES_MODULE = YES; 636 | DEVELOPMENT_TEAM = ""; 637 | DYLIB_COMPATIBILITY_VERSION = 1; 638 | DYLIB_CURRENT_VERSION = 1; 639 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 640 | INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; 641 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 642 | LD_RUNPATH_SEARCH_PATHS = ( 643 | "$(inherited)", 644 | "@executable_path/Frameworks", 645 | "@loader_path/Frameworks", 646 | ); 647 | PRODUCT_BUNDLE_IDENTIFIER = "com.k-lpmg.AwaitToast"; 648 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 649 | PROVISIONING_PROFILE_SPECIFIER = ""; 650 | SKIP_INSTALL = YES; 651 | SWIFT_VERSION = 5.0; 652 | TARGETED_DEVICE_FAMILY = "1,2"; 653 | }; 654 | name = Debug; 655 | }; 656 | 659E38FE222BA21A00062BDE /* Release */ = { 657 | isa = XCBuildConfiguration; 658 | buildSettings = { 659 | CODE_SIGN_IDENTITY = ""; 660 | CODE_SIGN_STYLE = Manual; 661 | DEFINES_MODULE = YES; 662 | DEVELOPMENT_TEAM = ""; 663 | DYLIB_COMPATIBILITY_VERSION = 1; 664 | DYLIB_CURRENT_VERSION = 1; 665 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 666 | INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; 667 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 668 | LD_RUNPATH_SEARCH_PATHS = ( 669 | "$(inherited)", 670 | "@executable_path/Frameworks", 671 | "@loader_path/Frameworks", 672 | ); 673 | PRODUCT_BUNDLE_IDENTIFIER = "com.k-lpmg.AwaitToast"; 674 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 675 | PROVISIONING_PROFILE_SPECIFIER = ""; 676 | SKIP_INSTALL = YES; 677 | SWIFT_VERSION = 5.0; 678 | TARGETED_DEVICE_FAMILY = "1,2"; 679 | }; 680 | name = Release; 681 | }; 682 | 659E3956222BA27800062BDE /* Debug */ = { 683 | isa = XCBuildConfiguration; 684 | buildSettings = { 685 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 686 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 687 | CLANG_ENABLE_MODULES = YES; 688 | CODE_SIGN_IDENTITY = ""; 689 | CODE_SIGN_STYLE = Manual; 690 | DEVELOPMENT_TEAM = ""; 691 | INFOPLIST_FILE = Example/Info.plist; 692 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 693 | LD_RUNPATH_SEARCH_PATHS = ( 694 | "$(inherited)", 695 | "@executable_path/Frameworks", 696 | ); 697 | PRODUCT_BUNDLE_IDENTIFIER = "com.k-lpmg.Example"; 698 | PRODUCT_NAME = "$(TARGET_NAME)"; 699 | PROVISIONING_PROFILE_SPECIFIER = ""; 700 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 701 | SWIFT_VERSION = 5.0; 702 | TARGETED_DEVICE_FAMILY = "1,2"; 703 | }; 704 | name = Debug; 705 | }; 706 | 659E3957222BA27800062BDE /* Release */ = { 707 | isa = XCBuildConfiguration; 708 | buildSettings = { 709 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 710 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 711 | CLANG_ENABLE_MODULES = YES; 712 | CODE_SIGN_IDENTITY = ""; 713 | CODE_SIGN_STYLE = Manual; 714 | DEVELOPMENT_TEAM = ""; 715 | INFOPLIST_FILE = Example/Info.plist; 716 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 717 | LD_RUNPATH_SEARCH_PATHS = ( 718 | "$(inherited)", 719 | "@executable_path/Frameworks", 720 | ); 721 | PRODUCT_BUNDLE_IDENTIFIER = "com.k-lpmg.Example"; 722 | PRODUCT_NAME = "$(TARGET_NAME)"; 723 | PROVISIONING_PROFILE_SPECIFIER = ""; 724 | SWIFT_VERSION = 5.0; 725 | TARGETED_DEVICE_FAMILY = "1,2"; 726 | }; 727 | name = Release; 728 | }; 729 | /* End XCBuildConfiguration section */ 730 | 731 | /* Begin XCConfigurationList section */ 732 | 659E38EE222BA21A00062BDE /* Build configuration list for PBXProject "AwaitToast" */ = { 733 | isa = XCConfigurationList; 734 | buildConfigurations = ( 735 | 659E38FA222BA21A00062BDE /* Debug */, 736 | 659E38FB222BA21A00062BDE /* Release */, 737 | ); 738 | defaultConfigurationIsVisible = 0; 739 | defaultConfigurationName = Release; 740 | }; 741 | 659E38FC222BA21A00062BDE /* Build configuration list for PBXNativeTarget "AwaitToast" */ = { 742 | isa = XCConfigurationList; 743 | buildConfigurations = ( 744 | 659E38FD222BA21A00062BDE /* Debug */, 745 | 659E38FE222BA21A00062BDE /* Release */, 746 | ); 747 | defaultConfigurationIsVisible = 0; 748 | defaultConfigurationName = Release; 749 | }; 750 | 659E3955222BA27800062BDE /* Build configuration list for PBXNativeTarget "Example" */ = { 751 | isa = XCConfigurationList; 752 | buildConfigurations = ( 753 | 659E3956222BA27800062BDE /* Debug */, 754 | 659E3957222BA27800062BDE /* Release */, 755 | ); 756 | defaultConfigurationIsVisible = 0; 757 | defaultConfigurationName = Release; 758 | }; 759 | /* End XCConfigurationList section */ 760 | }; 761 | rootObject = 659E38EB222BA21A00062BDE /* Project object */; 762 | } 763 | -------------------------------------------------------------------------------- /AwaitToast.xcodeproj/xcshareddata/xcschemes/AwaitToast.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Assets.xcassets/await.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "await.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Assets.xcassets/await.imageset/await.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k-lpmg/AwaitToast/d86462c9ecfac90b842381d05c856bdd27f92cd2/Example/Assets.xcassets/await.imageset/await.png -------------------------------------------------------------------------------- /Example/Assets.xcassets/egg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "egg.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Assets.xcassets/egg.imageset/egg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k-lpmg/AwaitToast/d86462c9ecfac90b842381d05c856bdd27f92cd2/Example/Assets.xcassets/egg.imageset/egg.png -------------------------------------------------------------------------------- /Example/Assets.xcassets/exit.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "exit.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Assets.xcassets/exit.imageset/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k-lpmg/AwaitToast/d86462c9ecfac90b842381d05c856bdd27f92cd2/Example/Assets.xcassets/exit.imageset/exit.png -------------------------------------------------------------------------------- /Example/Assets.xcassets/longText.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "longText.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Assets.xcassets/longText.imageset/longText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k-lpmg/AwaitToast/d86462c9ecfac90b842381d05c856bdd27f92cd2/Example/Assets.xcassets/longText.imageset/longText.png -------------------------------------------------------------------------------- /Example/Assets.xcassets/toast.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "toast.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Assets.xcassets/toast.imageset/toast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k-lpmg/AwaitToast/d86462c9ecfac90b842381d05c856bdd27f92cd2/Example/Assets.xcassets/toast.imageset/toast.png -------------------------------------------------------------------------------- /Example/Assets.xcassets/trash.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "trash.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Assets.xcassets/trash.imageset/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k-lpmg/AwaitToast/d86462c9ecfac90b842381d05c856bdd27f92cd2/Example/Assets.xcassets/trash.imageset/trash.png -------------------------------------------------------------------------------- /Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Example/Sources/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 28/02/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | let window = UIWindow(frame: UIScreen.main.bounds) 18 | let rootViewController = UINavigationController(rootViewController: ToastExampleTableViewController()) 19 | window.rootViewController = rootViewController 20 | window.backgroundColor = .white 21 | window.makeKeyAndVisible() 22 | self.window = window 23 | return true 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Example/Sources/Cells/ExampleTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleTableViewCell.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 03/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class ExampleTableViewCell: UITableViewCell { 12 | 13 | // MARK: - Constants 14 | 15 | static let reuseIdentifier = "ExampleTableViewCell" 16 | 17 | // MARK: - UI Components 18 | 19 | private let iconImageView: UIImageView = { 20 | let imageView = UIImageView() 21 | imageView.translatesAutoresizingMaskIntoConstraints = false 22 | return imageView 23 | }() 24 | private let actionLabel: UILabel = { 25 | let label = UILabel() 26 | label.translatesAutoresizingMaskIntoConstraints = false 27 | label.font = UIFont.preferredFont(forTextStyle: .subheadline) 28 | label.textAlignment = .left 29 | label.textColor = .darkGray 30 | return label 31 | }() 32 | private let targetLabel: UILabel = { 33 | let label = UILabel() 34 | label.translatesAutoresizingMaskIntoConstraints = false 35 | label.font = UIFont.preferredFont(forTextStyle: .body) 36 | label.textAlignment = .right 37 | label.textColor = .gray 38 | return label 39 | }() 40 | 41 | // MARK: - Con(De)structor 42 | 43 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 44 | super.init(style: style, reuseIdentifier: reuseIdentifier) 45 | 46 | contentView.addSubview(iconImageView) 47 | contentView.addSubview(actionLabel) 48 | contentView.addSubview(targetLabel) 49 | layout() 50 | } 51 | 52 | required init?(coder aDecoder: NSCoder) { 53 | fatalError("init(coder:) has not been implemented") 54 | } 55 | 56 | // MARK: - Internal methods 57 | 58 | func configure(with type: ExampleCellType) { 59 | iconImageView.image = UIImage(named: type.imageName) 60 | actionLabel.text = type.action 61 | targetLabel.text = type.target 62 | } 63 | 64 | func configure(image: UIImage, action: String, target: String) { 65 | iconImageView.image = image 66 | actionLabel.text = action 67 | targetLabel.text = target 68 | } 69 | 70 | } 71 | 72 | // MARK: - Layout 73 | 74 | extension ExampleTableViewCell { 75 | 76 | private func layout() { 77 | iconImageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16).isActive = true 78 | iconImageView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 16).isActive = true 79 | iconImageView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -16).isActive = true 80 | iconImageView.widthAnchor.constraint(equalToConstant: 32).isActive = true 81 | 82 | actionLabel.leadingAnchor.constraint(equalTo: iconImageView.trailingAnchor, constant: 16).isActive = true 83 | actionLabel.centerYAnchor.constraint(equalTo: iconImageView.centerYAnchor).isActive = true 84 | actionLabel.setContentHuggingPriority(.required, for: .horizontal) 85 | 86 | targetLabel.leadingAnchor.constraint(equalTo: actionLabel.trailingAnchor, constant: 8).isActive = true 87 | targetLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -16).isActive = true 88 | targetLabel.centerYAnchor.constraint(equalTo: iconImageView.centerYAnchor).isActive = true 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /Example/Sources/Cells/SettingSwitchTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SettingSwitchTableViewCell.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 04/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol SettingSwitchTableViewCellDelegate: NSObjectProtocol { 12 | func settingSwitchTableViewCell(_ cell: SettingSwitchTableViewCell, switchUpdated isOn: Bool) 13 | } 14 | 15 | final class SettingSwitchTableViewCell: UITableViewCell { 16 | 17 | // MARK: - Constants 18 | 19 | static let reuseIdentifier = "SettingSwitchTableViewCell" 20 | 21 | // MARK: - Properties 22 | 23 | var indexPath: IndexPath? 24 | var isSwitchOn: Bool? = nil { 25 | didSet { 26 | guard let isSwitchOn = isSwitchOn else {return} 27 | settingSwitch.isOn = isSwitchOn 28 | } 29 | } 30 | weak var delegate: SettingSwitchTableViewCellDelegate? 31 | 32 | // MARK: - UI Components 33 | 34 | private let settingLabel: UILabel = { 35 | let label = UILabel() 36 | label.translatesAutoresizingMaskIntoConstraints = false 37 | label.font = UIFont.preferredFont(forTextStyle: .subheadline) 38 | label.textAlignment = .left 39 | label.textColor = .darkGray 40 | return label 41 | }() 42 | private let settingSwitch: UISwitch = { 43 | let settingSwitch = UISwitch() 44 | settingSwitch.translatesAutoresizingMaskIntoConstraints = false 45 | return settingSwitch 46 | }() 47 | 48 | // MARK: - Con(De)structor 49 | 50 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 51 | super.init(style: style, reuseIdentifier: reuseIdentifier) 52 | 53 | setProperties() 54 | setSelector() 55 | contentView.addSubview(settingLabel) 56 | contentView.addSubview(settingSwitch) 57 | layout() 58 | } 59 | 60 | required init?(coder aDecoder: NSCoder) { 61 | fatalError("init(coder:) has not been implemented") 62 | } 63 | 64 | // MARK: - Internal methods 65 | 66 | func configure(with text: String) { 67 | settingLabel.text = text 68 | } 69 | 70 | // MARK: - Private methods 71 | 72 | private func setProperties() { 73 | selectionStyle = .none 74 | } 75 | 76 | private func setSelector() { 77 | settingSwitch.addTarget(self, action: #selector(switchValueChanged), for: .valueChanged) 78 | } 79 | 80 | // MARK: - Private selector 81 | 82 | @objc private func switchValueChanged() { 83 | delegate?.settingSwitchTableViewCell(self, switchUpdated: settingSwitch.isOn) 84 | } 85 | 86 | 87 | } 88 | 89 | // MARK: - Layout 90 | 91 | extension SettingSwitchTableViewCell { 92 | 93 | private func layout() { 94 | settingLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16).isActive = true 95 | settingLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true 96 | 97 | settingSwitch.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true 98 | settingSwitch.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -16).isActive = true 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /Example/Sources/Enums/AwaitExampleCellType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitExampleCellType.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 06/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | enum AwaitExampleCellType: Int, CaseIterable, ExampleCellType { 10 | case defaultAwait 11 | case finishDefaultAwait 12 | case iconAwait 13 | case finishIconAwait 14 | case dismissAwaitLatestToast 15 | case dismissAllToast 16 | 17 | var action: String { 18 | switch self { 19 | case .defaultAwait: 20 | return "Show" 21 | case .finishDefaultAwait: 22 | return "Finish" 23 | case .iconAwait: 24 | return "Show" 25 | case .finishIconAwait: 26 | return "Finish" 27 | case .dismissAwaitLatestToast: 28 | return "Dismiss" 29 | case .dismissAllToast: 30 | return "Dismiss" 31 | } 32 | } 33 | 34 | var target: String { 35 | switch self { 36 | case .defaultAwait: 37 | return "default await toast" 38 | case .finishDefaultAwait: 39 | return "default await toast" 40 | case .iconAwait: 41 | return "icon await toast" 42 | case .finishIconAwait: 43 | return "icon await toast" 44 | case .dismissAwaitLatestToast: 45 | return "await latest toast" 46 | case .dismissAllToast: 47 | return "all toast" 48 | } 49 | } 50 | 51 | var imageName: String { 52 | switch self { 53 | case .defaultAwait: 54 | return "await" 55 | case .finishDefaultAwait: 56 | return "exit" 57 | case .iconAwait: 58 | return "await" 59 | case .finishIconAwait: 60 | return "exit" 61 | case .dismissAwaitLatestToast: 62 | return "trash" 63 | case .dismissAllToast: 64 | return "trash" 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Example/Sources/Enums/DefaultExampleCellType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultExampleCellType.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 06/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | enum DefaultExampleCellType: Int, CaseIterable, ExampleCellType { 10 | case `default` 11 | case icon 12 | case dismissDefaultLatestToast 13 | case dismissAllToast 14 | 15 | var action: String { 16 | switch self { 17 | case .default: 18 | return "Show" 19 | case .icon: 20 | return "Show" 21 | case .dismissDefaultLatestToast: 22 | return "Dismiss" 23 | case .dismissAllToast: 24 | return "Dismiss" 25 | } 26 | } 27 | 28 | var target: String { 29 | switch self { 30 | case .default: 31 | return "default toast" 32 | case .icon: 33 | return "icon toast" 34 | case .dismissDefaultLatestToast: 35 | return "default latest toast" 36 | case .dismissAllToast: 37 | return "all toast" 38 | } 39 | } 40 | 41 | var imageName: String { 42 | switch self { 43 | case .default: 44 | return "toast" 45 | case .icon: 46 | return "toast" 47 | case .dismissDefaultLatestToast: 48 | return "trash" 49 | case .dismissAllToast: 50 | return "trash" 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Example/Sources/Enums/ExampleCellType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleCellType.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 03/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | protocol ExampleCellType { 10 | var action: String { get } 11 | var target: String { get } 12 | var imageName: String { get } 13 | } 14 | -------------------------------------------------------------------------------- /Example/Sources/Enums/LongTextCellType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LongTextCellType.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 01/04/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | enum LongTextCellType: Int, CaseIterable { 10 | case automaticDimension 11 | case longTestToast 12 | 13 | var title: String { 14 | switch self { 15 | case .automaticDimension: 16 | return "AutomaticDimension" 17 | case .longTestToast: 18 | return "" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Example/Sources/Enums/SectionType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SectionType.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 04/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | enum SectionType: Int, CaseIterable { 10 | case settings 11 | case defaultExamples 12 | case awaitExamples 13 | case longText 14 | 15 | var title: String { 16 | switch self { 17 | case .settings: 18 | return "Settings" 19 | case .defaultExamples: 20 | return "Default Examples" 21 | case .awaitExamples: 22 | return "Await Examples" 23 | case .longText: 24 | return "Long Text Example" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/Sources/Enums/SettingCellType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SettingCellType.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 04/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | enum SettingCellType: Int, CaseIterable { 10 | case tapToDismiss 11 | case topDirection 12 | 13 | var title: String { 14 | switch self { 15 | case .tapToDismiss: 16 | return "Tap to dismiss" 17 | case .topDirection: 18 | return "Top direction" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Example/Sources/ToastExampleTableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastExampleTableViewController.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 03/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | import AwaitToast 12 | 13 | final class ToastExampleTableViewController: UITableViewController { 14 | 15 | // MARK: - Properties 16 | 17 | let sections = SectionType.allCases 18 | let settings = SettingCellType.allCases 19 | let defaultExamples = DefaultExampleCellType.allCases 20 | let awaitExamples = AwaitExampleCellType.allCases 21 | let longTextExample = LongTextCellType.allCases 22 | 23 | var defaultAwaitToast: AwaitToast? 24 | var iconAwaitToast: AwaitToast? 25 | var direction: ToastDirection = .top 26 | 27 | // MARK: - Overridden: UITableViewController 28 | 29 | override func viewDidLoad() { 30 | super.viewDidLoad() 31 | 32 | setAppearance() 33 | setProperties() 34 | } 35 | 36 | // MARK: - UITableViewDataSource 37 | 38 | override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { 39 | return sections[section].title 40 | } 41 | 42 | override func numberOfSections(in tableView: UITableView) -> Int { 43 | return sections.count 44 | } 45 | 46 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 47 | switch sections[section] { 48 | case .settings: 49 | return settings.count 50 | case .defaultExamples: 51 | return defaultExamples.count 52 | case .awaitExamples: 53 | return awaitExamples.count 54 | case .longText: 55 | return longTextExample.count 56 | } 57 | } 58 | 59 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 60 | switch sections[indexPath.section] { 61 | case .settings: 62 | let cell = tableView.dequeueReusableCell(withIdentifier: SettingSwitchTableViewCell.reuseIdentifier, for: indexPath) as! SettingSwitchTableViewCell 63 | cell.indexPath = indexPath 64 | cell.delegate = self 65 | cell.configure(with: settings[indexPath.row].title) 66 | 67 | if let setting = SettingCellType(rawValue: indexPath.row) { 68 | switch setting { 69 | case .tapToDismiss: 70 | cell.isSwitchOn = ToastBehaviorManager.default.isTappedDismissEnabled && ToastBehaviorManager.await.isTappedDismissEnabled 71 | case .topDirection: 72 | cell.isSwitchOn = direction == .top 73 | } 74 | } 75 | return cell 76 | case .defaultExamples: 77 | let cell = tableView.dequeueReusableCell(withIdentifier: ExampleTableViewCell.reuseIdentifier, for: indexPath) as! ExampleTableViewCell 78 | cell.configure(with: defaultExamples[indexPath.row] as ExampleCellType) 79 | return cell 80 | case .awaitExamples: 81 | let cell = tableView.dequeueReusableCell(withIdentifier: ExampleTableViewCell.reuseIdentifier, for: indexPath) as! ExampleTableViewCell 82 | cell.configure(with: awaitExamples[indexPath.row] as ExampleCellType) 83 | return cell 84 | case .longText: 85 | let longTextCell = LongTextCellType(rawValue: indexPath.row)! 86 | switch longTextCell { 87 | case .automaticDimension: 88 | let cell = tableView.dequeueReusableCell(withIdentifier: SettingSwitchTableViewCell.reuseIdentifier, for: indexPath) as! SettingSwitchTableViewCell 89 | cell.indexPath = indexPath 90 | cell.delegate = self 91 | cell.configure(with: longTextCell.title) 92 | 93 | cell.isSwitchOn = ToastAppearanceManager.default.height == AutomaticDimension 94 | return cell 95 | case .longTestToast: 96 | let cell = tableView.dequeueReusableCell(withIdentifier: ExampleTableViewCell.reuseIdentifier, for: indexPath) as! ExampleTableViewCell 97 | cell.configure(image: UIImage(named: "longText")!, action: "Show", target: "Default long text") 98 | return cell 99 | } 100 | } 101 | } 102 | 103 | // MARK: - UITableViewDelegate 104 | 105 | override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 106 | return 64 107 | } 108 | 109 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 110 | tableView.deselectRow(at: indexPath, animated: true) 111 | 112 | switch sections[indexPath.section] { 113 | case .defaultExamples: 114 | guard let cellType = DefaultExampleCellType(rawValue: indexPath.row) else {return} 115 | 116 | switch cellType { 117 | case .default: 118 | let toast = Toast.default(text: "Default toast", direction: direction) 119 | toast.show() 120 | case .icon: 121 | let image = UIImage(named: "egg")!.withRenderingMode(.alwaysTemplate) 122 | let toast = Toast.icon(image: image, text: "Icon toast", direction: direction) 123 | toast.show() 124 | case .dismissDefaultLatestToast: 125 | Toast.latestDismiss() 126 | case .dismissAllToast: 127 | Toast.dismissAll() 128 | } 129 | case .awaitExamples: 130 | guard let cellType = AwaitExampleCellType(rawValue: indexPath.row) else {return} 131 | 132 | switch cellType { 133 | case .defaultAwait: 134 | defaultAwaitToast?.finish() 135 | 136 | defaultAwaitToast = AwaitToast.default(initialText: "Await default toast start", endText: "Await default toast end", direction: direction) 137 | defaultAwaitToast?.show() 138 | case .finishDefaultAwait: 139 | defaultAwaitToast?.finish() 140 | case .iconAwait: 141 | iconAwaitToast?.finish() 142 | 143 | let image = UIImage(named: "egg")!.withRenderingMode(.alwaysTemplate) 144 | iconAwaitToast = AwaitToast.icon(image: image, initialText: "Await icon toast start", endText: "Await icon toast end", direction: direction) 145 | iconAwaitToast?.show() 146 | case .finishIconAwait: 147 | iconAwaitToast?.finish() 148 | case .dismissAwaitLatestToast: 149 | AwaitToast.latestDismiss() 150 | case .dismissAllToast: 151 | AwaitToast.dismissAll() 152 | } 153 | case .longText: 154 | guard let cellType = LongTextCellType(rawValue: indexPath.row) else {return} 155 | 156 | switch cellType { 157 | case .longTestToast: 158 | let text = """ 159 | This is long text line 1 160 | This is long text line 2 161 | This is long text line 3 162 | This is long text line 4 163 | This is long text line 5 164 | This is long text line 6 165 | This is long text line 7 166 | This is long text line 8 167 | This is long text line 9 168 | This is long text line 10 169 | This is long text line 11 170 | This is long text line 12 171 | This is long text line 13 172 | """ 173 | let toast = Toast.default(text: text, direction: direction) 174 | toast.show() 175 | default: 176 | break 177 | } 178 | default: 179 | break 180 | } 181 | } 182 | 183 | // MARK: - Private methods 184 | 185 | private func setAppearance() { 186 | ToastAppearanceManager.icon.imageTintColor = .white 187 | } 188 | 189 | private func setProperties() { 190 | title = "AwaitToast" 191 | tableView.estimatedRowHeight = 64 192 | tableView.rowHeight = UITableView.automaticDimension 193 | tableView.register(SettingSwitchTableViewCell.self, forCellReuseIdentifier: SettingSwitchTableViewCell.reuseIdentifier) 194 | tableView.register(ExampleTableViewCell.self, forCellReuseIdentifier: ExampleTableViewCell.reuseIdentifier) 195 | } 196 | 197 | } 198 | 199 | // MARK: - SettingSwitchTableViewCellDelegate 200 | 201 | extension ToastExampleTableViewController: SettingSwitchTableViewCellDelegate { 202 | 203 | func settingSwitchTableViewCell(_ cell: SettingSwitchTableViewCell, switchUpdated isOn: Bool) { 204 | guard let indexPath = cell.indexPath else {return} 205 | 206 | switch sections[indexPath.section] { 207 | case .settings: 208 | guard let type = SettingCellType(rawValue: cell.indexPath?.row ?? -1) else {return} 209 | 210 | switch type { 211 | case .tapToDismiss: 212 | ToastBehaviorManager.default.isTappedDismissEnabled = isOn 213 | ToastBehaviorManager.await.isTappedDismissEnabled = isOn 214 | case .topDirection: 215 | direction = isOn ? .top : .bottom 216 | } 217 | case .longText: 218 | guard let type = LongTextCellType(rawValue: cell.indexPath?.row ?? -1) else {return} 219 | 220 | switch type { 221 | case .automaticDimension: 222 | ToastAppearanceManager.default.height = isOn ? AutomaticDimension : 96 223 | default: 224 | break 225 | } 226 | default: 227 | break 228 | } 229 | } 230 | 231 | } 232 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.2.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 DongHee Kang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AwaitToast 2 | [![Build Status](https://travis-ci.org/k-lpmg/AwaitToast.svg?branch=master)](https://travis-ci.org/k-lpmg/AwaitToast) 3 | ![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg) 4 | [![Cocoapods](https://img.shields.io/cocoapods/v/AwaitToast.svg?style=flat)](https://cocoapods.org/pods/AwaitToast) 5 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 6 | 7 | 🍞 An async waiting toast with basic toast. Inspired by facebook posting toast. 8 | 9 | ## Introduction 10 |

11 | 12 | 13 |

14 |

15 | 16 | 17 |

18 | 19 | ## Usage 20 | 21 | #### Default 22 | ```swift 23 | let toast: Toast = Toast.default(text: "Toast is started") 24 | 25 | // Show 26 | toast.show() 27 | 28 | // Dismiss 29 | toast.dismiss() 30 | 31 | // Bottom Direction 32 | Toast.default(text: "Toast is started", direction: .bottom) 33 | ``` 34 | 35 | #### Await 36 | ```swift 37 | let awaitToast: AwaitToast = AwaitToast.default(initialText: "Toast is started", endText: "Toast is ended") 38 | 39 | // Show 40 | awaitToast.show() 41 | 42 | // Finish 43 | awaitToast.finish() 44 | 45 | // Dismiss 46 | awaitToast.dismiss() 47 | ``` 48 | 49 | #### Dismiss 50 | ```swift 51 | // Last toast in queue dismiss 52 | Toast.latestDismiss() 53 | AwaitToast.latestDismiss() 54 | 55 | // All toast in queue dismiss 56 | Toast.dismissAll() 57 | AwaitToast.dismissAll() 58 | ``` 59 | 60 | #### Appearance 61 | ```swift 62 | // Get singleton appearance object 63 | let defaultAppearance = ToastAppearanceManager.default 64 | let iconAppearance = ToastAppearanceManager.icon 65 | 66 | // Update singletone appearance properties 67 | defaultAppearance.height = 128 68 | defaultAppearance.backgroundColor = .white 69 | defaultAppearance.numberOfLines = 1 70 | defaultAppearance.textAlignment = .left 71 | ... 72 | ``` 73 | 74 | #### Behavior 75 | ```swift 76 | // Get singleton behavior object 77 | let defaultBehavior = ToastBehaviorManager.default 78 | let awaitBehavior = ToastBehaviorManager.await 79 | 80 | // Update singletone behavior properties 81 | defaultBehavior.isTappedDismissEnabled = false 82 | defaultBehavior.delay = 3.0 83 | defaultBehavior.showDurarion = 0.3 84 | defaultBehavior.duration = 3.0 85 | defaultBehavior.dismissDuration = 0.3 86 | ... 87 | ``` 88 | 89 | #### Self-sizing 90 | 91 | 92 | ```swift 93 | ToastAppearanceManager.default.height = AutomaticDimension 94 | ToastAppearanceManager.icon.height = AutomaticDimension 95 | ``` 96 | 97 | ## Installation 98 | 99 | #### CocoaPods (iOS 9+) 100 | 101 | ```ruby 102 | platform :ios, '9.0' 103 | use_frameworks! 104 | 105 | target '' do 106 | pod 'AwaitToast' 107 | end 108 | ``` 109 | 110 | #### Carthage (iOS 9+) 111 | 112 | ```ruby 113 | github "k-lpmg/AwaitToast" 114 | ``` 115 | 116 | 117 | ## LICENSE 118 | 119 | These works are available under the MIT license. See the [LICENSE][license] file 120 | for more info. 121 | 122 | [license]: LICENSE 123 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Appearances/DefaultToastAppearance.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultToastAppearance.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public final class DefaultToastAppearance: ToastAppearance { 12 | 13 | static var shared: DefaultToastAppearance = .init() 14 | required init() { 15 | } 16 | 17 | // EdgeInsets 18 | public var titleEdgeInsets: UIEdgeInsets = UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16) 19 | 20 | // ToastView 21 | public var height: CGFloat = 96 22 | public var backgroundColor: UIColor = UIColor.black 23 | 24 | // TextLabel 25 | public var numberOfLines: Int = 0 26 | public var textAlignment: NSTextAlignment = .center 27 | public var textFont: UIFont = UIFont.preferredFont(forTextStyle: .subheadline) 28 | public var textColor: UIColor = .white 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Appearances/IconToastAppearance.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IconToastAppearance.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public final class IconToastAppearance: ToastAppearance { 12 | 13 | static var shared: IconToastAppearance = .init() 14 | required init() { 15 | } 16 | 17 | // EdgeInsets 18 | public var titleEdgeInsets: UIEdgeInsets = UIEdgeInsets(top: 16, left: 8, bottom: 16, right: 16) 19 | public var imageEdgeInsets: UIEdgeInsets = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 8) 20 | 21 | // ToastView 22 | public var height: CGFloat = 96 23 | public var backgroundColor: UIColor = UIColor.black 24 | 25 | // ImageView 26 | public var imageContentMode: UIView.ContentMode = .scaleToFill 27 | public var imageTintColor: UIColor? = nil 28 | 29 | // TextLabel 30 | public var numberOfLines: Int = 0 31 | public var textAlignment: NSTextAlignment = .left 32 | public var textFont: UIFont = UIFont.preferredFont(forTextStyle: .subheadline) 33 | public var textColor: UIColor = .white 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Appearances/ToastAppearance.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastAppearance.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 28/02/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol ToastAppearance: class { 12 | 13 | static var shared: Self { get set } 14 | 15 | init() 16 | 17 | // EdgeInsets 18 | var titleEdgeInsets: UIEdgeInsets { get set } 19 | 20 | // ToastView 21 | var height: CGFloat { get set } 22 | var backgroundColor: UIColor { get set } 23 | 24 | // TextLabel 25 | var numberOfLines: Int { get set } 26 | var textAlignment: NSTextAlignment { get set } 27 | var textFont: UIFont { get set } 28 | var textColor: UIColor { get set } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Appearances/ToastAppearanceManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastAppearanceManager.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | public enum ToastAppearanceManager { 10 | public static var `default` = DefaultToastAppearance.shared 11 | public static var icon = IconToastAppearance.shared 12 | } 13 | -------------------------------------------------------------------------------- /Sources/AwaitToast/AwaitToast.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitToast.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 03/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | public class AwaitToast: ToastCompatiable { 10 | 11 | // MARK: - Properties 12 | 13 | static var operationQueue: OperationQueue = { 14 | let queue = OperationQueue() 15 | queue.name = "com.k-lpmg.AwaitToast.operationQueue" 16 | return queue 17 | }() 18 | 19 | // MARK: - Class methods 20 | 21 | public class func latestDismiss() { 22 | operationQueue.operations.last?.cancel() 23 | } 24 | 25 | public class func dismissAll() { 26 | operationQueue.cancelAllOperations() 27 | } 28 | 29 | // MARK: - Public methods 30 | 31 | public func finish() { 32 | toastAbstractMethod() 33 | } 34 | 35 | public func show() { 36 | toastAbstractMethod() 37 | } 38 | 39 | public func dismiss() { 40 | toastAbstractMethod() 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Behaviors/AwaitToastBehavior.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitToastBehavior.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 03/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | public final class AwaitToastBehavior: ToastBehavior { 10 | 11 | static var shared: AwaitToastBehavior = .init() 12 | required init() { 13 | } 14 | 15 | public var isTappedDismissEnabled: Bool = true 16 | 17 | public var delay: TimeInterval = 0.0 18 | 19 | public var showDurarion: TimeInterval = 0.2 20 | 21 | public var finishDurarion: TimeInterval = 0.2 22 | 23 | public var dismissDelayWhenFinish: TimeInterval = 0.4 24 | 25 | public var dismissDuration: TimeInterval = 0.2 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Behaviors/DefaultToastBehavior.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultToastBehavior.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | public final class DefaultToastBehavior: ToastBehavior { 10 | 11 | static var shared: DefaultToastBehavior = .init() 12 | required init() { 13 | } 14 | 15 | public var isTappedDismissEnabled: Bool = true 16 | 17 | public var delay: TimeInterval = 0.0 18 | 19 | public var showDurarion: TimeInterval = 0.2 20 | 21 | public var duration: TimeInterval = 3.0 22 | 23 | public var dismissDuration: TimeInterval = 0.2 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Behaviors/ToastBehavior.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastBehavior.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | protocol ToastBehavior { 10 | 11 | static var shared: Self { get set } 12 | 13 | init() 14 | 15 | var isTappedDismissEnabled: Bool { get set } 16 | 17 | var delay: TimeInterval { get set } 18 | 19 | var showDurarion: TimeInterval { get set} 20 | 21 | var dismissDuration: TimeInterval { get set } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Behaviors/ToastBehaviorManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastBehaviorManager.swift 3 | // Example 4 | // 5 | // Created by DongHeeKang on 04/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | public enum ToastBehaviorManager { 10 | public static var `default` = DefaultToastBehavior.shared 11 | public static var await = AwaitToastBehavior.shared 12 | } 13 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Operations/AwaitToastOperation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitToastOperation.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class AwaitToastOperation: ToastOperation where A: ToastAppearance { 12 | 13 | // MARK: - Properties 14 | 15 | private var initialWorkItem: DispatchWorkItem? 16 | private lazy var finishWorkkItem: DispatchWorkItem = DispatchWorkItem { [weak self] in 17 | guard let self = self, let view = self.view as? AwaitToastView else {return} 18 | 19 | view.finish(duration: self.behavior.finishDurarion) { 20 | DispatchQueue.main.asyncAfter(deadline: .now() + self.behavior.dismissDelayWhenFinish, execute: { 21 | self.dismiss() 22 | }) 23 | } 24 | } 25 | 26 | // MARK: - Overridden: Operation 27 | 28 | override func main() { 29 | initialWorkItem = DispatchWorkItem { [weak self] in 30 | guard let self = self else {return} 31 | 32 | self.showToast() 33 | } 34 | DispatchQueue.main.asyncAfter(deadline: .now() + behavior.delay, execute: initialWorkItem!) 35 | } 36 | 37 | override func cancel() { 38 | super.cancel() 39 | 40 | initialWorkItem?.cancel() 41 | dismiss() 42 | } 43 | 44 | // MARK: - Internal methods 45 | 46 | func finish() { 47 | DispatchQueue.main.async(execute: finishWorkkItem) 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Operations/DefaultToastOperation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastOperation.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 01/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class DefaultToastOperation: ToastOperation where A: ToastAppearance { 12 | 13 | // MARK: - Properties 14 | 15 | private var workItem: DispatchWorkItem? 16 | 17 | // MARK: - Overridden: Operation 18 | 19 | override func main() { 20 | workItem = DispatchWorkItem { [weak self] in 21 | guard let self = self else {return} 22 | 23 | defer { 24 | DispatchQueue.main.asyncAfter(deadline: .now() + self.behavior.duration, execute: { 25 | guard self.workItem?.isCancelled == false else {return} 26 | 27 | self.dismiss() 28 | }) 29 | } 30 | 31 | self.showToast() 32 | } 33 | DispatchQueue.main.async(execute: workItem!) 34 | } 35 | 36 | override func cancel() { 37 | super.cancel() 38 | 39 | workItem?.cancel() 40 | dismiss() 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Operations/ToastDynamicDispatch.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastDynamicDispatch.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | final class ToastDynamicDispatch { 10 | 11 | weak var view: UIView? 12 | unowned let operation: Operation 13 | 14 | init(view: UIView? = nil, operation: Operation) { 15 | self.view = view 16 | self.operation = operation 17 | setSelector() 18 | } 19 | 20 | // MARK: - Private methods 21 | 22 | private func setSelector() { 23 | view?.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(viewTapped))) 24 | } 25 | 26 | // MARK: - Private selector 27 | 28 | @objc func viewTapped() { 29 | operation.cancel() 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Operations/ToastOperation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastOperation.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | fileprivate let kIsFinished = "isFinished" 12 | 13 | class ToastOperation: Operation where A: ToastAppearance, B: ToastBehavior { 14 | 15 | // MARK: - Properties 16 | 17 | var view: ToastView 18 | let behavior: B = B.shared 19 | 20 | private var _dynamicDispatch: ToastDynamicDispatch! 21 | 22 | // MARK: - Con(De)structor 23 | 24 | init(view: ToastView) { 25 | self.view = view 26 | super.init() 27 | 28 | _dynamicDispatch = .init(view: behavior.isTappedDismissEnabled ? view : nil, operation: self) 29 | } 30 | 31 | // MARK: - Overridden: Operation 32 | 33 | private var _finished = false 34 | override var isFinished: Bool { 35 | get { 36 | return _finished 37 | } 38 | set { 39 | willChangeValue(forKey: kIsFinished) 40 | _finished = newValue 41 | didChangeValue(forKey: kIsFinished) 42 | } 43 | } 44 | 45 | override func main() { 46 | toastAbstractMethod() 47 | } 48 | 49 | // MARK: - Internal methods 50 | 51 | func dismiss(completion: ((Bool) -> Void)? = nil) { 52 | self.isFinished = true 53 | 54 | let toOriginX = view.frame.origin.x 55 | let toOriginY: CGFloat 56 | switch view.direction { 57 | case .top: 58 | toOriginY = -view.bounds.height 59 | case .bottom: 60 | toOriginY = view.frame.origin.y + view.bounds.height 61 | } 62 | 63 | UIView.animate(withDuration: behavior.dismissDuration, 64 | animations: { 65 | self.view.frame.origin = CGPoint(x: toOriginX, y: toOriginY) 66 | }, 67 | completion: { (_) in 68 | self.view.removeFromSuperview() 69 | }) 70 | } 71 | 72 | func showToast() { 73 | guard let window = UIApplication.shared.keyWindow else {return} 74 | 75 | window.addSubview(view) 76 | view.translatesAutoresizingMaskIntoConstraints = false 77 | view.leadingAnchor.constraint(equalTo: window.leadingAnchor).isActive = true 78 | view.trailingAnchor.constraint(equalTo: window.trailingAnchor).isActive = true 79 | if view.appearance.height == AutomaticDimension { 80 | view.heightAnchor.constraint(greaterThanOrEqualToConstant: 0).isActive = true 81 | } else { 82 | let safeAreaPadding: CGFloat 83 | switch view.direction { 84 | case .top: 85 | safeAreaPadding = UIApplication.shared.statusBarFrame.size.height 86 | case .bottom: 87 | if #available(iOS 11.0, *), let window = UIApplication.shared.keyWindow { 88 | safeAreaPadding = window.safeAreaInsets.bottom 89 | } else { 90 | safeAreaPadding = 0 91 | } 92 | } 93 | view.heightAnchor.constraint(equalToConstant: view.appearance.height + safeAreaPadding).isActive = true 94 | } 95 | 96 | let initialViewYAnchor: NSLayoutConstraint 97 | let toViewYAnchor: NSLayoutConstraint 98 | switch self.view.direction { 99 | case .top: 100 | initialViewYAnchor = self.view.bottomAnchor.constraint(equalTo: window.topAnchor) 101 | toViewYAnchor = self.view.topAnchor.constraint(equalTo: window.topAnchor) 102 | case .bottom: 103 | initialViewYAnchor = self.view.topAnchor.constraint(equalTo: window.bottomAnchor) 104 | toViewYAnchor = self.view.bottomAnchor.constraint(equalTo: window.bottomAnchor) 105 | } 106 | initialViewYAnchor.isActive = true 107 | window.layoutIfNeeded() 108 | 109 | UIView.animate(withDuration: behavior.showDurarion) { 110 | initialViewYAnchor.isActive = false 111 | toViewYAnchor.isActive = true 112 | window.layoutIfNeeded() 113 | } 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toast.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Toast.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 28/02/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | public class Toast: ToastCompatiable { 10 | 11 | // MARK: - Properties 12 | 13 | static var operationQueue: OperationQueue = { 14 | let queue = OperationQueue() 15 | queue.name = "com.k-lpmg.Toast.operationQueue" 16 | return queue 17 | }() 18 | 19 | // MARK: - Class methods 20 | 21 | public class func latestDismiss() { 22 | operationQueue.operations.last?.cancel() 23 | } 24 | 25 | public class func dismissAll() { 26 | operationQueue.cancelAllOperations() 27 | } 28 | 29 | // MARK: - Public methods 30 | 31 | public func show() { 32 | toastAbstractMethod() 33 | } 34 | 35 | public func dismiss() { 36 | toastAbstractMethod() 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Sources/AwaitToast/ToastCompatiable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastCompatiable.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 28/02/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | protocol ToastCompatiable { 10 | static var operationQueue: OperationQueue { get set } 11 | func show() 12 | func dismiss() 13 | } 14 | -------------------------------------------------------------------------------- /Sources/AwaitToast/ToastDirection.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastDirection.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 01/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | public enum ToastDirection { 10 | case top 11 | case bottom 12 | } 13 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/AwaitToastProducer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitToastProducer.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 03/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | class AwaitToastProducer: AwaitToast where A: ToastAppearance { 10 | 11 | var view: AwaitToastView! 12 | 13 | private let _operation: AwaitToastOperation 14 | 15 | init(view: AwaitToastView) { 16 | self.view = view 17 | self._operation = AwaitToastOperation(view: view) 18 | } 19 | 20 | override func show() { 21 | type(of: self).operationQueue.addOperation(_operation) 22 | } 23 | 24 | override func finish() { 25 | _operation.finish() 26 | } 27 | 28 | override func dismiss() { 29 | _operation.cancel() 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/AwaitToastView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitToastView.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class AwaitToastView: ToastView where A: ToastAppearance { 12 | 13 | var endTextLabelFrame: CGRect { 14 | let titleEdgeInsets = appearance.titleEdgeInsets 15 | 16 | let originY: CGFloat 17 | switch direction { 18 | case .top: 19 | originY = -contentView.bounds.height 20 | case .bottom: 21 | originY = contentView.bounds.height 22 | } 23 | let originX = titleEdgeInsets.left 24 | let width = contentView.bounds.width - titleEdgeInsets.left - titleEdgeInsets.right 25 | let height = contentView.bounds.height - titleEdgeInsets.top - titleEdgeInsets.bottom 26 | return CGRect(x: originX, y: originY, width: width, height: height) 27 | } 28 | 29 | var endTextLabelToOriginY: CGFloat { 30 | return appearance.titleEdgeInsets.top 31 | } 32 | 33 | func finish(duration: TimeInterval, completion: (() -> Void)? = nil) { 34 | toastAbstractMethod() 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/Default/AwaitDefault.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitDefault.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | extension AwaitToast { 10 | 11 | public static func `default`(initialText: String, endText: String, direction: ToastDirection = .top) -> AwaitToast { 12 | return AwaitDefault(initialText: initialText, endText: endText, direction: direction) 13 | } 14 | 15 | public static func `default`(initialAttributedString: NSAttributedString, endAttributedString: NSAttributedString, direction: ToastDirection = .top) -> AwaitToast { 16 | return AwaitDefault(initialAttributedString: initialAttributedString, endAttributedString: endAttributedString, direction: direction) 17 | } 18 | 19 | } 20 | 21 | final private class AwaitDefault: AwaitToastProducer { 22 | 23 | init(initialText: String, endText: String, direction: ToastDirection) { 24 | super.init(view: AwaitDefaultToastView(initialText: initialText, endText: endText, direction: direction)) 25 | } 26 | 27 | init(initialAttributedString: NSAttributedString, endAttributedString: NSAttributedString, direction: ToastDirection) { 28 | super.init(view: AwaitDefaultToastView(initialAttributedString: initialAttributedString, endAttributedString: endAttributedString, direction: direction)) 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/Default/AwaitDefaultToastView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitDefaultToastView.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class AwaitDefaultToastView: AwaitToastView { 12 | 13 | // MARK: - Properties 14 | 15 | let initialText: String? 16 | let endText: String? 17 | let initialAttributedString: NSAttributedString? 18 | let endAttributedString: NSAttributedString? 19 | 20 | // MARK: - UI Components 21 | 22 | lazy var initialTextLabel: UILabel = { 23 | let label = UILabel() 24 | label.translatesAutoresizingMaskIntoConstraints = false 25 | label.numberOfLines = appearance.numberOfLines 26 | label.textAlignment = appearance.textAlignment 27 | label.font = appearance.textFont 28 | label.textColor = appearance.textColor 29 | return label 30 | }() 31 | lazy var endTextLabel: UILabel = { 32 | let label = UILabel() 33 | label.numberOfLines = appearance.numberOfLines 34 | label.textAlignment = appearance.textAlignment 35 | label.font = appearance.textFont 36 | label.textColor = appearance.textColor 37 | return label 38 | }() 39 | 40 | // MARK: - Con(De)structor 41 | 42 | init(initialText: String, endText: String, direction: ToastDirection) { 43 | self.initialText = initialText 44 | self.endText = endText 45 | self.initialAttributedString = nil 46 | self.endAttributedString = nil 47 | super.init(direction: direction) 48 | 49 | commonInit() 50 | initialTextLabel.text = initialText 51 | endTextLabel.text = endText 52 | } 53 | 54 | init(initialAttributedString: NSAttributedString, endAttributedString: NSAttributedString, direction: ToastDirection) { 55 | self.initialText = nil 56 | self.endText = nil 57 | self.initialAttributedString = initialAttributedString 58 | self.endAttributedString = endAttributedString 59 | super.init(direction: direction) 60 | 61 | commonInit() 62 | initialTextLabel.attributedText = initialAttributedString 63 | endTextLabel.attributedText = endAttributedString 64 | } 65 | 66 | required init?(coder aDecoder: NSCoder) { 67 | fatalError("init(coder:) has not been implemented") 68 | } 69 | 70 | // MARK: - Overridden: AwaitToastView 71 | 72 | override func finish(duration: TimeInterval, completion: (() -> Void)? = nil) { 73 | initialTextLabel.removeFromSuperview() 74 | 75 | contentView.addSubview(endTextLabel) 76 | endTextLabel.frame = endTextLabelFrame 77 | 78 | UIView.animate(withDuration: duration, animations: { 79 | var frame = self.endTextLabel.frame 80 | frame.origin.y = self.endTextLabelToOriginY 81 | self.endTextLabel.frame = frame 82 | }) { (_) in 83 | completion?() 84 | } 85 | } 86 | 87 | // MARK: - Internal methods 88 | 89 | func commonInit() { 90 | contentView.addSubview(initialTextLabel) 91 | layout() 92 | } 93 | 94 | } 95 | 96 | // MARK: - Layout 97 | 98 | extension AwaitDefaultToastView { 99 | 100 | private func layout() { 101 | let titleEdgeInsets = appearance.titleEdgeInsets 102 | initialTextLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: titleEdgeInsets.left).isActive = true 103 | initialTextLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: titleEdgeInsets.top).isActive = true 104 | initialTextLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -titleEdgeInsets.right).isActive = true 105 | initialTextLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -titleEdgeInsets.bottom).isActive = true 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/Default/Default.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Default.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 28/02/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | extension Toast { 10 | 11 | public static func `default`(text: String, direction: ToastDirection = .top) -> Toast { 12 | return Default(text: text, direction: direction) 13 | } 14 | 15 | public static func `default`(attributedString: NSAttributedString, direction: ToastDirection = .top) -> Toast { 16 | return Default(attributedString: attributedString, direction: direction) 17 | } 18 | 19 | } 20 | 21 | final private class Default: DefaultToastProducer { 22 | 23 | init(text: String, direction: ToastDirection) { 24 | super.init(view: DefaultToastView(text: text, direction: direction)) 25 | } 26 | 27 | init(attributedString: NSAttributedString, direction: ToastDirection) { 28 | super.init(view: DefaultToastView(attributedString: attributedString, direction: direction)) 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/Default/DefaultToastView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultToastView.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 01/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class DefaultToastView: ToastView { 12 | 13 | // MARK: - Properties 14 | 15 | let text: String? 16 | let attributedString: NSAttributedString? 17 | 18 | // MARK: - UI Components 19 | 20 | lazy var textLabel: UILabel = { 21 | let label = UILabel() 22 | label.translatesAutoresizingMaskIntoConstraints = false 23 | label.numberOfLines = appearance.numberOfLines 24 | label.textAlignment = appearance.textAlignment 25 | label.font = appearance.textFont 26 | label.textColor = appearance.textColor 27 | return label 28 | }() 29 | 30 | // MARK: - Con(De)structor 31 | 32 | init(text: String, direction: ToastDirection) { 33 | self.text = text 34 | self.attributedString = nil 35 | super.init(direction: direction) 36 | 37 | commonInit() 38 | textLabel.text = text 39 | } 40 | 41 | init(attributedString: NSAttributedString, direction: ToastDirection) { 42 | self.text = nil 43 | self.attributedString = attributedString 44 | super.init(direction: direction) 45 | 46 | commonInit() 47 | textLabel.attributedText = attributedString 48 | } 49 | 50 | required init?(coder aDecoder: NSCoder) { 51 | fatalError("init(coder:) has not been implemented") 52 | } 53 | 54 | // MARK: - Internal methods 55 | 56 | func commonInit() { 57 | contentView.addSubview(textLabel) 58 | layout() 59 | } 60 | 61 | } 62 | 63 | // MARK: - Layout 64 | 65 | extension DefaultToastView { 66 | 67 | private func layout() { 68 | let titleEdgeInsets = appearance.titleEdgeInsets 69 | textLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: titleEdgeInsets.left).isActive = true 70 | textLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: titleEdgeInsets.top).isActive = true 71 | textLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -titleEdgeInsets.right).isActive = true 72 | textLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -titleEdgeInsets.bottom).isActive = true 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/DefaultToastProducer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultToastProducer.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 28/02/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | class DefaultToastProducer: Toast where A: ToastAppearance { 10 | 11 | var view: ToastView! 12 | 13 | private let _operation: DefaultToastOperation 14 | 15 | init(view: ToastView) { 16 | self.view = view 17 | self._operation = DefaultToastOperation(view: view) 18 | } 19 | 20 | override func show() { 21 | type(of: self).operationQueue.addOperation(_operation) 22 | } 23 | 24 | override func dismiss() { 25 | _operation.cancel() 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/Icon/AwaitIcon.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitIcon.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | extension AwaitToast { 10 | 11 | public static func icon(image: UIImage, imageLocation: IconImageLocation = .left, initialText: String, endText: String, direction: ToastDirection = .top) -> AwaitToast { 12 | return AwaitIcon(image: image, imageLocation: imageLocation, initialText: initialText, endText: endText, direction: direction) 13 | } 14 | 15 | public static func icon(image: UIImage, imageLocation: IconImageLocation = .left, initialAttributedString: NSAttributedString, endAttributedString: NSAttributedString, direction: ToastDirection = .top) -> AwaitToast { 16 | return AwaitIcon(image: image, imageLocation: imageLocation, initialAttributedString: initialAttributedString, endAttributedString: endAttributedString, direction: direction) 17 | } 18 | 19 | } 20 | 21 | final private class AwaitIcon: AwaitToastProducer { 22 | 23 | init(image: UIImage, imageLocation: IconImageLocation, initialText: String, endText: String, direction: ToastDirection) { 24 | super.init(view: AwaitIconToastView(image: image, imageLocation: imageLocation, initialText: initialText, endText: endText, direction: direction)) 25 | } 26 | 27 | init(image: UIImage, imageLocation: IconImageLocation, initialAttributedString: NSAttributedString, endAttributedString: NSAttributedString, direction: ToastDirection) { 28 | super.init(view: AwaitIconToastView(image: image, imageLocation: imageLocation, initialAttributedString: initialAttributedString, endAttributedString: endAttributedString, direction: direction)) 29 | } 30 | 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/Icon/AwaitIconToastView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AwaitIconToastView.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class AwaitIconToastView: AwaitToastView { 12 | 13 | // MARK: - Constants 14 | 15 | private enum Const { 16 | static let imageSize = CGSize(width: 24, height: 24) 17 | } 18 | 19 | // MARK: - Properties 20 | 21 | let image: UIImage? 22 | let imageLocation: IconImageLocation 23 | let initialText: String? 24 | let endText: String? 25 | let initialAttributedString: NSAttributedString? 26 | let endAttributedString: NSAttributedString? 27 | 28 | // MARK: - UI Components 29 | 30 | lazy var imageView: UIImageView = { 31 | let imageView = UIImageView() 32 | imageView.translatesAutoresizingMaskIntoConstraints = false 33 | imageView.image = image 34 | imageView.contentMode = appearance.imageContentMode 35 | imageView.tintColor = appearance.imageTintColor 36 | return imageView 37 | }() 38 | lazy var initialTextLabel: UILabel = { 39 | let label = UILabel() 40 | label.translatesAutoresizingMaskIntoConstraints = false 41 | label.numberOfLines = appearance.numberOfLines 42 | label.textAlignment = appearance.textAlignment 43 | label.font = appearance.textFont 44 | label.textColor = appearance.textColor 45 | return label 46 | }() 47 | lazy var endTextLabel: UILabel = { 48 | let label = UILabel() 49 | label.numberOfLines = appearance.numberOfLines 50 | label.textAlignment = appearance.textAlignment 51 | label.font = appearance.textFont 52 | label.textColor = appearance.textColor 53 | return label 54 | }() 55 | 56 | // MARK: - Con(De)structor 57 | 58 | init(image: UIImage, imageLocation: IconImageLocation, initialText: String, endText: String, direction: ToastDirection) { 59 | self.image = image 60 | self.imageLocation = imageLocation 61 | self.initialText = initialText 62 | self.endText = endText 63 | self.initialAttributedString = nil 64 | self.endAttributedString = nil 65 | super.init(direction: direction) 66 | 67 | commonInit() 68 | initialTextLabel.text = initialText 69 | endTextLabel.text = endText 70 | } 71 | 72 | init(image: UIImage, imageLocation: IconImageLocation, initialAttributedString: NSAttributedString, endAttributedString: NSAttributedString, direction: ToastDirection) { 73 | self.image = image 74 | self.imageLocation = imageLocation 75 | self.initialText = nil 76 | self.endText = nil 77 | self.initialAttributedString = initialAttributedString 78 | self.endAttributedString = endAttributedString 79 | super.init(direction: direction) 80 | 81 | commonInit() 82 | initialTextLabel.attributedText = initialAttributedString 83 | endTextLabel.attributedText = endAttributedString 84 | } 85 | 86 | required init?(coder aDecoder: NSCoder) { 87 | fatalError("init(coder:) has not been implemented") 88 | } 89 | 90 | // MARK: - Overridden: AwaitToastView 91 | 92 | override func finish(duration: TimeInterval, completion: (() -> Void)? = nil) { 93 | let imageViewFrame = imageView.frame 94 | let initialTextLabelFrame = initialTextLabel.frame 95 | initialTextLabel.removeFromSuperview() 96 | imageView.removeFromSuperview() 97 | 98 | imageView.translatesAutoresizingMaskIntoConstraints = true 99 | contentView.addSubview(imageView) 100 | contentView.addSubview(endTextLabel) 101 | 102 | var frame = endTextLabelFrame 103 | frame.origin.x = initialTextLabelFrame.origin.x 104 | endTextLabel.frame = frame 105 | imageView.frame = CGRect(x: imageViewFrame.origin.x, y: frame.origin.y, width: Const.imageSize.width, height: Const.imageSize.height) 106 | 107 | UIView.animate(withDuration: duration, animations: { 108 | var endTextLabelFrame = self.endTextLabel.frame 109 | endTextLabelFrame.origin.y = self.endTextLabelToOriginY 110 | self.endTextLabel.frame = endTextLabelFrame 111 | 112 | let imageEdgeInsets = self.appearance.imageEdgeInsets 113 | var imageViewFrame = self.imageView.frame 114 | imageViewFrame.origin.y = endTextLabelFrame.midY - Const.imageSize.height/2 + imageEdgeInsets.top - imageEdgeInsets.bottom 115 | self.imageView.frame = imageViewFrame 116 | }) { (_) in 117 | completion?() 118 | } 119 | } 120 | 121 | // MARK: - Internal methods 122 | 123 | func commonInit() { 124 | contentView.addSubview(imageView) 125 | contentView.addSubview(initialTextLabel) 126 | layout() 127 | } 128 | 129 | } 130 | 131 | // MARK: - Layout 132 | 133 | extension AwaitIconToastView { 134 | 135 | private func layout() { 136 | let titleEdgeInsets = appearance.titleEdgeInsets 137 | let imageEdgeInsets = appearance.imageEdgeInsets 138 | 139 | let imageViewTopConstant = imageEdgeInsets.top - imageEdgeInsets.bottom 140 | imageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor, constant: imageViewTopConstant).isActive = true 141 | imageView.widthAnchor.constraint(equalToConstant: Const.imageSize.width).isActive = true 142 | imageView.heightAnchor.constraint(equalToConstant: Const.imageSize.height).isActive = true 143 | 144 | initialTextLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: titleEdgeInsets.top).isActive = true 145 | initialTextLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -titleEdgeInsets.bottom).isActive = true 146 | 147 | switch imageLocation { 148 | case .left: 149 | imageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: imageEdgeInsets.left).isActive = true 150 | 151 | let textLabelLeftConstant = titleEdgeInsets.left + imageEdgeInsets.right 152 | initialTextLabel.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: textLabelLeftConstant).isActive = true 153 | initialTextLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -titleEdgeInsets.right).isActive = true 154 | case .right: 155 | imageView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -imageEdgeInsets.right).isActive = true 156 | 157 | let textLabelRightConstant = titleEdgeInsets.right + imageEdgeInsets.left 158 | initialTextLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: titleEdgeInsets.left).isActive = true 159 | initialTextLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -textLabelRightConstant).isActive = true 160 | } 161 | } 162 | 163 | } 164 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/Icon/Icon.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Icon.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 28/02/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | extension Toast { 10 | 11 | public static func icon(image: UIImage, imageLocation: IconImageLocation = .left, text: String, direction: ToastDirection = .top) -> Toast { 12 | return Icon(image: image, imageLocation: imageLocation, text: text, direction: direction) 13 | } 14 | 15 | public static func icon(image: UIImage, imageLocation: IconImageLocation = .left, attributedString: NSAttributedString, direction: ToastDirection = .top) -> Toast { 16 | return Icon(image: image, imageLocation: imageLocation, attributedString: attributedString, direction: direction) 17 | } 18 | 19 | } 20 | 21 | final private class Icon: DefaultToastProducer { 22 | 23 | init(image: UIImage, imageLocation: IconImageLocation, text: String, direction: ToastDirection) { 24 | super.init(view: IconToastView(image: image, imageLocation: imageLocation, text: text, direction: direction)) 25 | } 26 | 27 | init(image: UIImage, imageLocation: IconImageLocation, attributedString: NSAttributedString, direction: ToastDirection) { 28 | super.init(view: IconToastView(image: image, imageLocation: imageLocation, attributedString: attributedString, direction: direction)) 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/Icon/IconImageLocation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IconImageLocation.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 02/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | public enum IconImageLocation { 10 | case left 11 | case right 12 | } 13 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/Icon/IconToastView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IconToastView.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 01/03/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class IconToastView: ToastView { 12 | 13 | // MARK: - Constants 14 | 15 | private enum Const { 16 | static let imageSize = CGSize(width: 24, height: 24) 17 | } 18 | 19 | // MARK: - Properties 20 | 21 | let image: UIImage? 22 | let imageLocation: IconImageLocation 23 | let text: String? 24 | let attributedString: NSAttributedString? 25 | 26 | // MARK: - UI Components 27 | 28 | lazy var imageView: UIImageView = { 29 | let imageView = UIImageView() 30 | imageView.translatesAutoresizingMaskIntoConstraints = false 31 | imageView.image = image 32 | imageView.contentMode = appearance.imageContentMode 33 | imageView.tintColor = appearance.imageTintColor 34 | return imageView 35 | }() 36 | lazy var textLabel: UILabel = { 37 | let label = UILabel() 38 | label.translatesAutoresizingMaskIntoConstraints = false 39 | label.numberOfLines = appearance.numberOfLines 40 | label.textAlignment = appearance.textAlignment 41 | label.font = appearance.textFont 42 | label.textColor = appearance.textColor 43 | return label 44 | }() 45 | 46 | // MARK: - Con(De)structor 47 | 48 | init(image: UIImage, imageLocation: IconImageLocation, text: String, direction: ToastDirection) { 49 | self.image = image 50 | self.imageLocation = imageLocation 51 | self.text = text 52 | self.attributedString = nil 53 | super.init(direction: direction) 54 | 55 | commonInit() 56 | textLabel.text = text 57 | } 58 | 59 | init(image: UIImage, imageLocation: IconImageLocation, attributedString: NSAttributedString, direction: ToastDirection) { 60 | self.image = image 61 | self.imageLocation = imageLocation 62 | self.text = nil 63 | self.attributedString = attributedString 64 | super.init(direction: direction) 65 | 66 | commonInit() 67 | textLabel.attributedText = attributedString 68 | } 69 | 70 | required init?(coder aDecoder: NSCoder) { 71 | fatalError("init(coder:) has not been implemented") 72 | } 73 | 74 | // MARK: - Internal methods 75 | 76 | func commonInit() { 77 | contentView.addSubview(imageView) 78 | contentView.addSubview(textLabel) 79 | layout() 80 | } 81 | 82 | } 83 | 84 | // MARK: - Layout 85 | 86 | extension IconToastView { 87 | 88 | private func layout() { 89 | let titleEdgeInsets = appearance.titleEdgeInsets 90 | let imageEdgeInsets = appearance.imageEdgeInsets 91 | 92 | let imageViewTopConstant = imageEdgeInsets.top - imageEdgeInsets.bottom 93 | imageView.centerYAnchor.constraint(equalTo: textLabel.centerYAnchor, constant: imageViewTopConstant).isActive = true 94 | imageView.widthAnchor.constraint(equalToConstant: Const.imageSize.width).isActive = true 95 | imageView.heightAnchor.constraint(equalToConstant: Const.imageSize.height).isActive = true 96 | 97 | textLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: titleEdgeInsets.top).isActive = true 98 | textLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -titleEdgeInsets.bottom).isActive = true 99 | 100 | switch imageLocation { 101 | case .left: 102 | imageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: imageEdgeInsets.left).isActive = true 103 | 104 | let textLabelLeftConstant = titleEdgeInsets.left + imageEdgeInsets.right 105 | textLabel.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: textLabelLeftConstant).isActive = true 106 | textLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -titleEdgeInsets.right).isActive = true 107 | case .right: 108 | imageView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -imageEdgeInsets.right).isActive = true 109 | 110 | let textLabelRightConstant = titleEdgeInsets.right + imageEdgeInsets.left 111 | textLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: titleEdgeInsets.left).isActive = true 112 | textLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -textLabelRightConstant).isActive = true 113 | } 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Toasts/ToastView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToastView.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 28/02/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ToastView: UIView where A: ToastAppearance { 12 | 13 | // MARK: - NSLayoutConstraints 14 | 15 | private var contentViewTop: NSLayoutConstraint? 16 | 17 | // MARK: - Properties 18 | 19 | let appearance: A = A.shared 20 | let direction: ToastDirection 21 | 22 | // MARK: - UI Components 23 | 24 | let contentView: UIView = { 25 | let view = UIView() 26 | return view 27 | }() 28 | 29 | // MARK: - Con(De)structor 30 | 31 | init(direction: ToastDirection) { 32 | self.direction = direction 33 | super.init(frame: .zero) 34 | 35 | backgroundColor = appearance.backgroundColor 36 | addSubview(contentView) 37 | layout() 38 | } 39 | 40 | required init?(coder aDecoder: NSCoder) { 41 | fatalError("init(coder:) has not been implemented") 42 | } 43 | 44 | } 45 | 46 | // MARK: - Layout 47 | 48 | extension ToastView { 49 | 50 | private func layout() { 51 | contentView.translatesAutoresizingMaskIntoConstraints = false 52 | contentView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true 53 | contentView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true 54 | 55 | let topConstant: CGFloat 56 | let bottomConstant: CGFloat 57 | switch direction { 58 | case .top: 59 | topConstant = UIApplication.shared.statusBarFrame.size.height 60 | bottomConstant = 0 61 | case .bottom: 62 | topConstant = 0 63 | if #available(iOS 11.0, *), let window = UIApplication.shared.keyWindow { 64 | bottomConstant = window.safeAreaInsets.bottom 65 | } else { 66 | bottomConstant = 0 67 | } 68 | } 69 | contentView.topAnchor.constraint(equalTo: topAnchor, constant: topConstant).isActive = true 70 | contentView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -bottomConstant).isActive = true 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Utils/GlobalConstants.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GlobalConstants.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 01/04/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | public let AutomaticDimension: CGFloat = -1 10 | -------------------------------------------------------------------------------- /Sources/AwaitToast/Utils/GlobalFunction.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GlobalFunction.swift 3 | // AwaitToast 4 | // 5 | // Created by DongHeeKang on 28/02/2019. 6 | // Copyright © 2019 k-lpmg. All rights reserved. 7 | // 8 | 9 | func toastAbstractMethod(file: StaticString = #file, line: UInt = #line) -> Swift.Never { 10 | toastFatalError("Abstract method", file: file, line: line) 11 | } 12 | 13 | func toastFatalError(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> Swift.Never { 14 | fatalError(lastMessage(), file: file, line: line) 15 | } 16 | --------------------------------------------------------------------------------