Skip to content

Commit

Permalink
Merge branch 'main' into maxg/add-priority-to-flow
Browse files Browse the repository at this point in the history
* main:
  Bumping versions to 5.0.0.
  Add precondition to `setNeedsViewHierarchyUpdate`. Expanded precondition message to encourage self-diagnosis.
  Renamed accessibility(...) to deprecated_accessibility(...) (#516)
  Annotate `updateViewHierarchyIfNeeded` and `update(node:context:)` with @mainactor and add `preconditionIsolated` runtime check
  Bump Github jobs to use macos-14
  Bump CI Xcode to 15.4 (from 15.1)
  • Loading branch information
maxg-square committed Nov 4, 2024
2 parents c291cf4 + cca3d70 commit 9ed2f9a
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
build:
name: Generate docs with jazzy and publish to Github pages
runs-on: macos-13-xlarge
runs-on: macos-14-xlarge

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/env.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
xcode_version=15.1
xcode_version=15.4.0
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
lint:
name: Lint Swift code with SwiftFormat
runs-on: macos-13-xlarge
runs-on: macos-14-xlarge

steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
spm:
name: "iOS ${{ matrix.sdk }}"

runs-on: macos-13-xlarge
runs-on: macos-14-xlarge

strategy:
fail-fast: false # Don’t fail-fast so that we get all snapshot test changes
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
cocoapods:
name: "CocoaPods"

runs-on: macos-13-xlarge
runs-on: macos-14-xlarge

steps:
- uses: actions/checkout@v4
Expand Down
29 changes: 29 additions & 0 deletions BlueprintUI/Sources/BlueprintView/BlueprintView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,16 @@ public final class BlueprintView: UIView {

/// Clears any sizing caches, invalidates the `intrinsicContentSize` of the
/// view, and marks the view as needing a layout.
@MainActor
private func setNeedsViewHierarchyUpdate() {
MainActor.preconditionIsolated(
"""
setNeedsViewHierarchyUpdate() must only execute on the main actor.
Examine your stack trace to determine what caused this to be called
off of the main actor.
"""
)

invalidateIntrinsicContentSize()
sizesThatFit.removeAll()
Expand All @@ -364,7 +373,17 @@ public final class BlueprintView: UIView {
setNeedsLayout()
}

@MainActor
private func updateViewHierarchyIfNeeded() {
MainActor.preconditionIsolated(
"""
updateViewHierarchyIfNeeded() must only execute on the main actor.
Examine your stack trace to determine what caused this to be called
off of the main actor.
"""
)

guard needsViewHierarchyUpdate || bounds != lastViewHierarchyUpdateBounds else { return }

precondition(
Expand Down Expand Up @@ -612,7 +631,17 @@ extension BlueprintView {
node.viewDescription.viewType == type(of: view)
}

@MainActor
fileprivate func update(node: NativeViewNode, context: UpdateContext) -> UpdateResult {
MainActor.preconditionIsolated(
"""
BlueprintView.NativeViewController.update(node:context:) must
only execute on the main actor.
Examine your stack trace to determine what caused this to be
called off of the main actor.
"""
)

assert(node.viewDescription.viewType == type(of: view))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ extension Element {
deprecated,
renamed: "accessibilityElement(label:value:traits:hint:identifier:accessibilityFrameSize:)"
)
public func accessibility(
public func deprecated_accessibility(
label: String? = nil,
value: String? = nil,
hint: String? = nil,
Expand Down
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Internal

- Bump CI Xcode version to 15.4.

# Past Releases

## [5.0.0] - 2024-10-30

### Added

- `BlueprintView` has added preconditions to some methods to ensure they are only invoked on the main queue.

### Changed

- Renamed deprecated function `accessibility(label:value:traits:hint:identifier:accessibilityFrameSize:)` to `deprecated_accessibility(label:value:traits:hint:identifier:accessibilityFrameSize:)`.

## [4.3.0] - 2024-09-18

### Added
Expand Down Expand Up @@ -1115,7 +1127,8 @@ searchField

- First stable release.

[main]: https://github.com/square/Blueprint/compare/4.3.0...HEAD
[main]: https://github.com/square/Blueprint/compare/5.0.0...HEAD
[5.0.0]: https://github.com/square/Blueprint/compare/4.3.0...5.0.0
[4.3.0]: https://github.com/square/Blueprint/compare/4.2.1...4.3.0
[4.2.1]: https://github.com/square/Blueprint/compare/4.2.0...4.2.1
[4.2.0]: https://github.com/square/Blueprint/compare/4.1.2...4.2.0
Expand Down
12 changes: 6 additions & 6 deletions SampleApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- BlueprintUI (4.3.0)
- BlueprintUI/Tests (4.3.0)
- BlueprintUICommonControls (4.3.0):
- BlueprintUI (= 4.3.0)
- BlueprintUI (5.0.0)
- BlueprintUI/Tests (5.0.0)
- BlueprintUICommonControls (5.0.0):
- BlueprintUI (= 5.0.0)

DEPENDENCIES:
- BlueprintUI (from `../BlueprintUI.podspec`)
Expand All @@ -16,8 +16,8 @@ EXTERNAL SOURCES:
:path: "../BlueprintUICommonControls.podspec"

SPEC CHECKSUMS:
BlueprintUI: be852bd1c895f5405af2c75a6aa8bef0dacf41a8
BlueprintUICommonControls: 41b66f55f4bbc8454e0e6fa01dbbabdd499accba
BlueprintUI: 0e2d2944bca6c0d6d96df711a43bce01154bb7ef
BlueprintUICommonControls: 8f400ee3ecf2bc58bd21cce29caba9f7c83d22b8

PODFILE CHECKSUM: 1cffac4623851f31dc42270ba99701e3825e6d67

Expand Down
2 changes: 1 addition & 1 deletion version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

BLUEPRINT_VERSION ||= '4.3.0'
BLUEPRINT_VERSION ||= '5.0.0'

SWIFT_VERSION ||= File.read(File.join(__dir__, '.swift-version'))

Expand Down

0 comments on commit 9ed2f9a

Please sign in to comment.