Skip to content

Bug: Publishing Changes from Within View Updates in present(...) #15

@graygillman

Description

@graygillman

Calling present(_:animation:transition:content:) triggers a SwiftUI runtime warning:

Publishing changes from within view updates is not allowed, this will cause undefined behavior.

This occurs because the method modifies a @published property (plugin) from within a withAnimation block, which is discouraged during SwiftUI view update cycles.

File and Line
File: PluginWidget.swift
Line: 39 (inside present(...))

Problematic Code
public func present(_ alignment: Alignment, animation: Animation? = .default, transition: AnyTransition = .opacity, content: @escaping () -> AnyView) { withAnimation(animation) { self.plugin = Plugin(alignment: alignment, transition: transition, content: content) } }

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions