Skip to content

V3.1.1

Latest

Choose a tag to compare

@NuPlay NuPlay released this 29 Aug 14:18
d9c3439

Patch release.
Fixes two regressions from 3.1.0.

Update from 3.1.0 if you ship on macOS.

🐛 macOS backgrounds were no longer transparent

3.1.0 guarded the drawsBackground KVC call with responds(to: NSSelectorFromString("setDrawsBackground:")).

WebKit declares the setter underscored, and there is no plain one:

// WKWebViewPrivate.h:882
@property (nonatomic, setter=_setDrawsBackground:) BOOL _drawsBackground;

setValue(_:forKey:) searches set<Key>:, then _set<Key>:, then ivars.
It finds _setDrawsBackground: at the second step, so the assignment had always worked — while responds(to:), asked about a selector that does not exist, had always returned false.

The guard therefore always took the else branch.
The background stayed opaque, and every macOS launch emitted a spurious webViewConfigurationFailed.

A guard meant to prevent a crash disabled the feature it was guarding.

Now uses underPageBackgroundColor, public WebKit API on iOS 15 and macOS 12.
No KVC, no private selectors.

🐛 cssGenerationFailed fired during a SwiftUI view update

The handler ran synchronously from makeUIView and updateUIView.

Mutating state inside it produced "Modifying state during view update" — the warning #72 reported and #74 fixed.
3.1.0 brought it back.

Errors are now delivered on the next main-queue turn.

🧪 Why 3.1.0 missed both

The 3.1.0 tests compared generated strings.
Neither defect is visible that way.

The new tests check behavior:

  • macOS transparency is asserted against a real WKWebView inside a hosted NSHostingView
  • callback timing is asserted by recording whether the reporting call had already returned when the handler ran

📖 Docs

Examples that did not compile:

  • .blue and .cyan were ambiguous between the Color and UIColor/NSColor overloads
  • let css was declared twice in one scope
  • fullScreenCover(item:) was bound to a String?, which is not Identifiable, and is iOS-only

Also removed 18 trailing-whitespace errors and normalized 17 British spellings that disagreed with the API on the same line.


Changelog · Full diff