@@ -51,32 +51,43 @@ class MTPale: UIView {
5151 switch toastType {
5252 case . success:
5353 headLabel. text = " Success "
54- circleImg. image = UIImage ( named : " success_icon_white " , in : bundle , compatibleWith : nil ) !
54+ circleImg. image = loadImage ( name : " success_icon_white " )
5555 sideBarView. backgroundColor = UIColor ( hex: " 6FCF97 " )
5656 circleView. backgroundColor = UIColor ( hex: " 6FCF97 " )
5757 toastView. backgroundColor = UIColor ( named: " alpha_green_dark " , in: bundle, compatibleWith: nil ) !
5858 break
5959 case . error:
6060 headLabel. text = " Error "
61- circleImg. image = UIImage ( named : " error_icon_white " , in : bundle , compatibleWith : nil ) !
61+ circleImg. image = loadImage ( name : " error_icon_white " )
6262 sideBarView. backgroundColor = UIColor ( hex: " EB5757 " )
6363 circleView. backgroundColor = UIColor ( hex: " EB5757 " )
6464 toastView. backgroundColor = UIColor ( named: " alpha_red_dark " , in: bundle, compatibleWith: nil ) !
6565 break
6666 case . warning:
6767 headLabel. text = " Warning "
68- circleImg. image = UIImage ( named : " warning_icon_white " , in : bundle , compatibleWith : nil ) !
68+ circleImg. image = loadImage ( name : " warning_icon_white " )
6969 sideBarView. backgroundColor = UIColor ( hex: " F2C94C " )
7070 circleView. backgroundColor = UIColor ( hex: " F2C94C " )
7171 toastView. backgroundColor = UIColor ( named: " alpha_yellow_dark " , in: bundle, compatibleWith: nil ) !
7272 break
7373 case . info:
7474 headLabel. text = " Info "
75- circleImg. image = UIImage ( named : " info_icon_white " , in : bundle , compatibleWith : nil ) !
75+ circleImg. image = loadImage ( name : " info_icon_white " )
7676 sideBarView. backgroundColor = UIColor ( hex: " 2F80ED " )
7777 circleView. backgroundColor = UIColor ( hex: " 2F80ED " )
7878 toastView. backgroundColor = UIColor ( named: " alpha_blue_dark " , in: bundle, compatibleWith: nil ) !
7979 break
8080 }
8181 }
82+
83+ func loadImage( name: String ) -> UIImage ? {
84+ let podBundle = Bundle ( for: MTPale . self)
85+ if let url = podBundle. url ( forResource: " MotionToastView " , withExtension: " bundle " ) {
86+ let bundle = Bundle ( url: url)
87+ return UIImage ( named: name, in: bundle, compatibleWith: nil )
88+ }
89+ print ( " MotionToastView " )
90+ return nil
91+ }
92+
8293}
0 commit comments