Skip to content

0.6.0 · Swift 6 ready, tidier API

Latest

Choose a tag to compare

@BigTsung BigTsung released this 04 Nov 06:30
· 4 commits to main since this release

Swift 6 ready, and a more consistent API.

.package(url: "https://github.com/BigTsung/SwiftUI-Motion-Library", from: "0.6.0")

Swift 6

Effects copied into an app that uses the Swift 6 language mode (with or without MainActor default isolation) failed to compile with "conformance … crosses into main actor-isolated code". Every path(in:) and animatableData is now nonisolated, and all 129 copyable effects compile in Swift 5, Swift 6, and Swift 6 with MainActor default isolation.

⚠️ Breaking: speed is now always a multiplier

speed: 1 is the default pace, 2 twice as fast, 0.5 half as fast. These effects used absolute units before. If you passed speed: to one of them, divide your value by the old default:

Effect Old default (unit) New value = old ÷
MarqueeText 40 (pt/s) 40
MarqueeWall 24 (pt/s) 24
CircularText 20 (°/s) 20
Flock 90 (pt/s) 90
ParticleField 14 (pt/s) 14
Starfield 0.35 0.35
RetroGrid 0.8 (rows/s) 0.8
WarpTunnel 1.2 (rings/s) 1.2
WeightWaveText 0.6 (waves/s) 0.6
TopographicLines 0.12 0.12
AuroraBackground 0.4 0.4
VoronoiCells 0.6 0.6

For example MarqueeText(title, speed: 60) becomes MarqueeText(title, speed: 1.5). If you never passed speed:, nothing changes.

Renamed (old names still work, with a deprecation warning and a fix-it)

Before After
StatusButton(…, tint:) StatusButton(…, color:)
HoldToConfirmButton(…, fillColor:) HoldToConfirmButton(…, color:)
RainOnGlass(tint:) RainOnGlass(color:)
SlidingTabs(…, tint:) SlidingTabs(…, color:)
.liquid(tint:), LiquidToggleStyle(tint:) .liquid(color:), LiquidToggleStyle(color:)
NetworkBackground(interactive:) NetworkBackground(isInteractive:)
.burst(…, isEnabled:) .burst(…, isActive:)
.inkBleed(from:) .inkBleed(origin:)
TypewriterText(…, interval: .milliseconds(60)) TypewriterText(…, interval: 0.06) (seconds)
MotionButtonStatus StatusButton.Status
SwipeDirection SwipeCardDirection

The deprecated names will be removed in 1.0.

Localised button titles

StatusButton, DownloadButton, SlideToConfirm and HoldToConfirmButton take a LocalizedStringKey (looked up in your app's strings) or any String, like SwiftUI's Button.

Also

  • README: animated hero mosaic at the top, plus a social preview image (Docs/social-preview.png).
  • Fixed three README GIFs that were recorded frozen (holographic card, like button, liquid toggle); the recorder now fails on a frozen GIF.

繁體中文摘要

  • 支援 Swift 6:直接複製到 Swift 6 App 的效果,現在都能直接編譯,包含預設 MainActor 隔離的專案。
  • ⚠️ 破壞性變更:speed 一律改為倍率(1 = 預設速度)。如果你曾經對上表 12 個效果傳入 speed:,請把原本的數值除以表中的舊預設值。沒傳過就不受影響。
  • 名稱統一:顏色參數一律叫 color,另有幾個參數和型別改名。舊名稱仍然可以用,只會出現 deprecated 警告,Xcode 可以一鍵修正;1.0 時會移除。
  • 按鈕標題支援多語系:可以傳 LocalizedStringKey 或 String。