Skip to content

Conversation

@scenee
Copy link
Owner

@scenee scenee commented Nov 23, 2025

Store content hosting controller reference and update it dynamically in updateUIViewController(), allowing panel content to change without recreation.

Resolved #672

Store content hosting controller reference and update it dynamically
in updateUIViewController(), allowing panel content to change without
recreation.

Resolved #672
@scenee scenee merged commit 52b0f7f into master Nov 27, 2025
12 checks passed
@scenee scenee deleted the iss-672 branch November 27, 2025 10:52
scenee pushed a commit that referenced this pull request Jan 15, 2026
When we enable floatingPanelScrollTracking on our view inside of the floating panel, some view updates are performed (i.e., SwiftUI views are being instantiated) but no rendering (i.e., body evaluations) occurs.

Example code:
```swift
content
    .floatingPanel(
        coordinator: ContentPanelCoordinator.self,
        onEvent: onEvent
    ) { proxy in
        panelContent
            .floatingPanelScrollTracking(proxy: proxy) // scroll tracking breaks view updates
    }
```

We tracked this down to the scroll tracking, and it seems that the performing of view updates inside of the ScrollViewRepresentable was missing.

This seems similar to #675.
Sina-KH added a commit to mytonwalletorg/FloatingPanel that referenced this pull request Jan 26, 2026
* Replace fatal errors in transitionDuration delegate methods (scenee#642)

This PR modifies the transitionDuration(using:) method in FloatingPanelController to return 0.0 instead of calling fatalError when the FloatingPanelController instance is not found. This change is crucial for several reasons:

1. Avoiding Crashes in Production: Using fatalError in production can lead to unexpected crashes, which are detrimental to user experience. It's safer to return a default value like 0.0 and handle the scenario gracefully.

2. Improved Stability: By returning 0.0, the application can continue running, allowing for better stability and user satisfaction. This approach also aligns with the principle of fail-safety, where the system continues operating under error conditions.

3. Real-World Case: In our large-scale project, we encountered a crash at this specific point due to the fatalError. Given the size and complexity of our application, it has been challenging to pinpoint the exact cause. Switching to a return value of 0.0 would significantly help us mitigate the issue and maintain app stability while we investigate further.

4. Maintainability: Returning a default value makes the codebase more maintainable and easier to debug, as it avoids abrupt termination and allows for logging or other error handling mechanisms.

* Version 2.8.5

* Fix doc comments' errors  (scenee#644)

* Fix doc comment errors in ObjC APIs
* Improve doc comments in LayoutAnchoring.swift

* Version 2.8.6

* Disallow interrupting the panel interaction while bouncing over the most expanded state (scenee#652)

I decided to disallow interrupting panel interactions while bouncing over the most expanded state in order to fix the 2nd issue in scenee#633, scenee#633 (comment).

* Reset `initialScrollOffset` after the attracting animation ends (scenee#659)

* Stop pinning the scroll offset in moving programmatically
* Add 'optional' string interpolation
* Add comments
* Add CoreTests.test_initial_scroll_offset_reset()
* ci: remove macos-12 jobs for the deprecation
* ci: name circleci jobs

* ci: use Xcode 16.2 (scenee#653)

* Added '--verbose' in cocoapods job
* Fixed 'error: No simulator runtime version'. Some of the example apps cannot be built on github actions.
> /Users/runner/work/FloatingPanel/FloatingPanel/Examples/Samples/Sources/Assets.xcassets: error: No simulator runtime version from [<DVTBuildVersion 21A342>, <DVTBuildVersion 21C62>, <DVTBuildVersion 21E213>, <DVTBuildVersion 21F79>, <DVTBuildVersion 22B81>] available to use with iphonesimulator SDK version <DVTBuildVersion 22C146>
* Used macos-15 to fix random build fails

* ci: use macos-15 for all testing to use Xcode 16.2

* Version 2.8.7

* Revert "Disallow interrupting the panel interaction while bouncing over the most expanded state (scenee#652)"

This reverts commit b0fd0d4.

This change had a problem normal cases. For example, in Maps example a
panel interaction jumps occurs because of this.

* Allow slight deviation when checking for anchor position.

This change addresses the 2nd issue reported in scenee#633. The previous attempt
in commit b0fd0d4 was intended to fix this, but it has a regression.
This change resolves the issue without introducing any regressions.

* Fix a miss spell

* Address scenee#661 issue since v2.8.0  (scenee#662)

See this comment for more details.
scenee#661 (comment)

* Version 2.8.8

* ci: add workflow_dispatch event trigger

* Update FloatingPanelController

* Dump the default config of swift-format on Xcode 16.3

* Lint the library code by built-in swift-format

* Ignore project.xcworkspace dir

* Update .swift-format

* Update the minimum deployment target to iOS 13

* Drop Xcode 13.4.1 support

The following errors occur only on Xcode 13.4.1. Addressing them would
significantly impair the usability of this library’s API. Therefore, I have
decided not to support Xcode 13.4.1.

> /.../FloatingPanel/Sources/SwiftUI/FloatingPanelView.swift:9:33: error: protocol 'FloatingPanelCoordinator' can only be used as a generic constraint because it has Self or associated type requirements
>     let coordinator: () -> (any FloatingPanelCoordinator)
>                                 ^
> /.../FloatingPanel/Sources/SwiftUI/FloatingPanelView.swift:78:42: error: protocol 'FloatingPanelCoordinator' can only be used as a generic constraint because it has Self or associated type requirements
>     public func makeCoordinator() -> any FloatingPanelCoordinator {
>                                          ^
> /.../FloatingPanel/Sources/SwiftUI/View+floatingPanel.swift:26:67: error: 'some' types are only implemented for the declared type of properties and subscripts and the return type of functions
>         @ViewBuilder _ content: @escaping (FloatingPanelProxy) -> some View
>                                                                   ^
> /.../FloatingPanel/Sources/SwiftUI/View+floatingPanel.swift:26:9: error: result builder attribute 'ViewBuilder' can only be applied to a parameter of function type
>         @ViewBuilder _ content: @escaping (FloatingPanelProxy) -> some View
>         ^
> /.../FloatingPanel/Sources/SwiftUI/View+floatingPanel.swift:24:31: error: default argument value of type 'FloatingPanelDefaultCoordinator.Type' cannot be converted to type 'T.Type'
>         coordinator: T.Type = FloatingPanelDefaultCoordinator.self,
>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                                                                    as! T.Type
> /.../FloatingPanel/Sources/SwiftUI/View+floatingPanel.swift:28:9: error: generic parameter 'ContentView' could not be inferred
>         FloatingPanelView(
>         ^
> /.../FloatingPanel/Sources/SwiftUI/FloatingPanelView.swift:8:49: note: 'ContentView' declared as parameter to type 'FloatingPanelView'
> public struct FloatingPanelView<MainView: View, ContentView: View>: UIViewControllerRepresentable {
>                                                 ^
> /.../FloatingPanel/Sources/SwiftUI/View+floatingPanel.swift:28:9: note: explicitly specify the generic arguments to fix this issue
>         FloatingPanelView(
>         ^
>                          <Self, <#ContentView: View#>>

* Expand timeout for some test cases in {Controller,Core}Tests

* Implement SwiftUI APIs based on the Maps-SwiftUI app

* Added SamplesSwiftUI
* Moved Maps-SwiftUI project in workspace
* Updated build tools
* Fixed xcode 15.1 build
* Added FloatingPanel.SurfaceAppearance.box()

* Polish source code of CoreTests a bit

* Take care of file paths including non-ASCII chars in SwiftFormatBuildToolPlugin

* Add .xcodesamplecode.plist

* Move 'assets' folder in 'Documentation' folder

* Update documentation for the new SwiftUI APIs

* Added 'FloatingPanel SwiftUI API Guide'
* Updated README

* ci: update example builds

* ci: fix swift 5.9 and 5.10 builds

* ci: use Xcode 16.3 and iOS 18.4

* Add CHANGELOG

* Version 3.0.0

* Modify the top page of the DocC

* Improve CoreTests a bit

* ci: fix the build environments

* Fix the pod spec for the SwiftUI APIs

* Version 3.0.1

* ci: remove builds using deprecated 'macos-13' machine

* Add support for UICornerConfiguration in iOS 26 (scenee#664)

* ci: add iOS 26 to test matrix

* Pass CoreTests.test_initial_scroll_offset_reset()

Since iOS 26, UIGestureRecognizer.state is not able to change even
if it's assigned a new value programmatically. Therefore, I created
MockPanGestureRecognizer to change the state property in testing.

* Fix a build error on Xcode 16

* Fix compilation conditions at c5291d7

* Enable to build it for iOS 12

* Add CoreTests.test_statePublisher

* ci: fix a job error

* Add 'Star History Chart' at the bottom of README

* Set minimum iOS version to v12

* Version 3.1.0

* Support dynamic content updates in SwiftUI

Store content hosting controller reference and update it dynamically
in updateUIViewController(), allowing panel content to change without
recreation.

Resolved scenee#672

* Improve SamplesSwiftUI

* ci: use Xcode 26.0.1 for all builds

* Fix shadow on iOS 26

* examples: fix animation glitch on iOS 26

* Version 3.2.0

* Remove badges from README

* ci: fix 'swiftpm' job

* Fix scroll offset reset due to floating-point precision errors (scenee#677)

When the panel is already at a boundary position, floating-point
precision errors on some devices (like iPhone 17 Pro Max) can cause
unexpected offset resets in the position calculation.

This commit addresses the layout issue where fractional values caused
incorrect position evaluation. Based on the initial fix and sample
project provided by @0x1306a94.

Co-authored-by: 0x1306a94 <onyxes_accent_0a@icloud.com>

* Perform view updates during scroll tracking (scenee#679)

When we enable floatingPanelScrollTracking on our view inside of the floating panel, some view updates are performed (i.e., SwiftUI views are being instantiated) but no rendering (i.e., body evaluations) occurs.

Example code:
```swift
content
    .floatingPanel(
        coordinator: ContentPanelCoordinator.self,
        onEvent: onEvent
    ) { proxy in
        panelContent
            .floatingPanelScrollTracking(proxy: proxy) // scroll tracking breaks view updates
    }
```

We tracked this down to the scroll tracking, and it seems that the performing of view updates inside of the ScrollViewRepresentable was missing.

This seems similar to scenee#675.

* Version 3.2.1

---------

Co-authored-by: Ivan Levin <100189059+LevinIvan@users.noreply.github.com>
Co-authored-by: Shin Yamamoto <shin@scenee.com>
Co-authored-by: Will Bishop <17292672+WillBishop@users.noreply.github.com>
Co-authored-by: 0x1306a94 <onyxes_accent_0a@icloud.com>
Co-authored-by: Sören Gade <gade.soeren@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SWIFT-UI ]How do I change the content in the floating panel depending on changes in another Swift-UI View

2 participants