Skip to content

Commit

Permalink
Updates for self review
Browse files Browse the repository at this point in the history
  • Loading branch information
brynbodayle committed Feb 23, 2024
1 parent 2ca6dc4 commit 7c76ca3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
unexpected dimensions
- Made new layout-based SwiftUI cell rendering option the default.
- Fixed an issue where a UIKit view bridged to SwiftUI that wraps would always take up the proposed
size instead of it's intrinsic width.
size instead of its intrinsic width.

## [0.10.0](https://github.com/airbnb/epoxy-ios/compare/0.9.0...0.10.0) - 2023-06-29

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ extension MeasuringViewRepresentable {
#if swift(>=5.7.1) // Proxy check for being built with the iOS 15 SDK
@available(iOS 16.0, tvOS 16.0, macOS 13.0, *)
extension ProposedViewSize {
/// Creates a size by replacing `nil`s with `UIView.noIntrinsicMetric`
/// Creates a size by capping infinite values to a significantly large value and replacing `nil`s
/// with `UIView.noIntrinsicMetric`
var viewTypeValue: CGSize {
.init(
width: width?.constraintSafeValue ?? ViewType.noIntrinsicMetric,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public final class SwiftUIMeasurementContainer<Content: ViewType>: ViewType {
public var proposedSize = CGSize.noIntrinsicMetric {
didSet {
guard oldValue != proposedSize else { return }
_resolvedStrategy = nil

// The proposed size is only used by the measurement, so just re-measure.
_measuredFittingSize = nil
Expand Down Expand Up @@ -141,6 +140,8 @@ public final class SwiftUIMeasurementContainer<Content: ViewType>: ViewType {
super.updateConstraints()
}

// test

// MARK: Private

/// The most recently measured intrinsic content size of the `uiView`, else `noIntrinsicMetric` if
Expand Down Expand Up @@ -296,6 +297,8 @@ public final class SwiftUIMeasurementContainer<Content: ViewType>: ViewType {

/// Measures the `uiView`, storing the resulting size in `measuredIntrinsicContentSize`.
private func measureView() -> CGSize {
// immediately update constraints to the latest values so that the measurements below take them
// into account
updateConstraintsForPlatformIfNeeded()
latestMeasurementBoundsSize = bounds.size

Expand Down Expand Up @@ -354,8 +357,8 @@ public enum SwiftUIMeasurementContainerStrategy {
/// Typically used for views that should expand greedily in both axes, e.g. a background view.
case proposed

/// The `uiView`'s receives either its intrinsic width or the proposed width, whichever is smaller. The view receives its height based
/// on the chosen width.
/// The `uiView`'s receives either its intrinsic width or the proposed width, whichever is smaller. The view receives its intrinsic height
/// based on the chosen width.
///
/// Typically used for views that have a height that's a function of their width, e.g. a row with
/// text that can wrap to multiple lines.
Expand Down

0 comments on commit 7c76ca3

Please sign in to comment.