From 8f6089f62ec02aaa2d73be8f1abcbe89847825cb Mon Sep 17 00:00:00 2001 From: Cem Olcay Date: Tue, 23 Dec 2014 16:02:50 +0200 Subject: [PATCH] Block based UIWebView added --- .../UserInterfaceState.xcuserstate | Bin 21903 -> 21538 bytes CEMKit-Swift/CEMKit.swift | 42 ++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/CEMKit-Swift.xcodeproj/project.xcworkspace/xcuserdata/cem.xcuserdatad/UserInterfaceState.xcuserstate b/CEMKit-Swift.xcodeproj/project.xcworkspace/xcuserdata/cem.xcuserdatad/UserInterfaceState.xcuserstate index a44da98884fa36667605298a2b5554c1ca3f2d1f..d362581e49f2bc596e00e39e3bcb5c76167d476e 100644 GIT binary patch delta 7758 zcmeHLhksPXx1Vyi2M9f63)z}%gKV*ET{qF!30nTrh;i;I*5YD!4u#~@Dz9&EC$bjW#C!x9B2aT z!7E@R*aY4HTfrXi9(W(@1^d7U;6v~c*bk0^FTq#f82B0-2j74b;3BvLE`y)I&)^EU z27U*BfIq=s&-}D0irS%g)E;#}9Z@IL8FfKjQ36Ur24qDUC=a=j2YFEd6`(@Y8}&g0 z&|owSRiH7b3XMaP&}1|d%|Z*&BJ>z~96gO1P$OD{n$XK=En0`xqgT*&v=hC9cA&a5t>P zDy+tOY`{IR6=&dF?7?2_!-cpA7vp|-5H80f@JKusSK%pmDxQX?;~Dq~{3Lz~KaCgT zXYdld0Q#%J(Zd=8(-zv657H+&u6z`x@^ z@J)OR|I0vz$4HnsrX$mpNnm7*oKY|;M#m&GDU6;mFfQ&4>Z~kcdNUh8xX%)LMZW;OK_Ac;l$2>kR+ZP) z)s$C92DS_%b^VJ=`u8ntq~v}Bi%WWqcr-GyzEyrH7z#{l!2mE23<70fFc?A-NH>y5 zq(nyKYr!L67|?(rU<4RR6eNi#iJYj2j%bI)cPoihQAv@Cq6jy(+g@iCs9sIFw^&jO z#tkSgaZi{~KD80lf_?)kBBRPDR@KMTd)eYxJ(v`8Y$8!NfXPH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^vMM diff --git a/CEMKit-Swift/CEMKit.swift b/CEMKit-Swift/CEMKit.swift index 0221f76..a6cd6e0 100644 --- a/CEMKit-Swift/CEMKit.swift +++ b/CEMKit-Swift/CEMKit.swift @@ -540,3 +540,45 @@ class BlockButton: UIButton { +// MARK: - UIWebView + +class BlockWebView: UIWebView, UIWebViewDelegate { + + var didStartLoad: ((NSURLRequest) -> ())? + var didFinishLoad: ((NSURLRequest) -> ())? + var didFailLoad: ((NSURLRequest, NSError) -> ())? + + var shouldStartLoadingRequest: ((NSURLRequest) -> (Bool))? + + override init(frame: CGRect) { + super.init(frame: frame) + delegate = self + } + + required init(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + + func webViewDidStartLoad(webView: UIWebView) { + didStartLoad? (webView.request!) + } + + func webViewDidFinishLoad(webView: UIWebView) { + didFinishLoad? (webView.request!) + } + + func webView(webView: UIWebView, didFailLoadWithError error: NSError) { + didFailLoad? (webView.request!, error) + } + + func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool { + if let should = shouldStartLoadingRequest { + return should (request) + } else { + return true + } + } + +} +