Skip to content

Commit

Permalink
Merge pull request #33 from NuPlay/fix/ForceUnwrap
Browse files Browse the repository at this point in the history
Handle nil value safely
  • Loading branch information
NuPlay authored May 2, 2023
2 parents b104bcf + 8b082fa commit 6e14ec7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/RichText/Views/Webview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ extension WebView {
public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
webView.evaluateJavaScript("document.getElementById(\"NuPlay_RichText\").offsetHeight", completionHandler: { (height, _) in
DispatchQueue.main.async {
withAnimation(self.parent.conf.transition) {
self.parent.dynamicHeight = height as! CGFloat
if let height = height as? CGFloat {
withAnimation(self.parent.conf.transition) {
self.parent.dynamicHeight = height
}
} else {
self.parent.dynamicHeight = 0
}
}
})
Expand Down

0 comments on commit 6e14ec7

Please sign in to comment.