Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Update the height within the current transaction to allow animated ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
gonzalezreal committed Dec 20, 2020
1 parent 041f5b2 commit 9e72b40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Sources/AttributedText/AttributedText_AppKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
nsView.openURL = context.environment.openURL

DispatchQueue.main.async {
height = nsView.intrinsicContentSize.height
// Update the height within the current transaction
$height
.transaction(context.transaction)
.wrappedValue = nsView.intrinsicContentSize.height
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion Sources/AttributedText/AttributedText_UIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
uiView.openURL = context.environment.openURL

DispatchQueue.main.async {
height = uiView.intrinsicContentSize.height
// Update the height within the current transaction
$height
.transaction(context.transaction)
.wrappedValue = uiView.intrinsicContentSize.height
}
}
}
Expand Down

0 comments on commit 9e72b40

Please sign in to comment.