Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Example/SPM/FlexLayoutSample-SPM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@
"$(inherited)",
);
INFOPLIST_FILE = "../FlexLayoutSample/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -631,7 +631,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "../FlexLayoutSample/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// swift-tools-version:5.3
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "FlexLayout",
platforms: [
.iOS(.v12),
.iOS(.v13),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minimum supported version has been raised to enable the use of MainActor.

For CocoaPods, the current minimum supported version is iOS 13.4.

https://developer.apple.com/documentation/swift/mainactor

],
products: [
.library(name: "FlexLayout", targets: ["FlexLayout"]),
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- FlexLayout (2.2.0):
- FlexLayout (2.2.1):
- Yoga (= 3.2.1)
- PinLayout (1.10.5)
- SwiftLint (0.55.1)
Expand All @@ -22,7 +22,7 @@ EXTERNAL SOURCES:
:path: "./"

SPEC CHECKSUMS:
FlexLayout: a8947ca2446760b5203ba5a3d862023c92a82fce
FlexLayout: fe365fe6e4a7bf1a53b7421a75acf4c7991e3575
PinLayout: f6c2b63a5a5b24864064e1d15c67de41b4e74748
SwiftLint: 3fe909719babe5537c552ee8181c0031392be933
Yoga: 636ce73bd247407928a7df089f3bc3675916b3ff
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Flexbox is an incredible improvement over UIStackView. It is simpler to use, muc


### Requirements
* iOS 12.0+
* Xcode 12.0+
* Swift Swift 4.0
* iOS 13.0+
* Xcode 13.0+
* Swift 5.5

### Content

Expand Down
1 change: 1 addition & 0 deletions Sources/Swift/FlexLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import FlexLayoutYogaKit
label.flex.margin(10)
```
*/
@MainActor
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flex creates and manages UIViews, so it should also use MainActor.

public final class Flex {

//
Expand Down
1 change: 1 addition & 0 deletions Sources/Swift/Impl/UIView+FlexLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import UIKit

@MainActor
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the flex property of UIView is isolated to the MainActor, the corresponding global variable is also annotated with MainActor instead of nonisolated.

private var flexLayoutAssociatedObjectHandle = 72_399_923

extension UIView {
Expand Down
1 change: 1 addition & 0 deletions Tests/FlexLayoutTests/FlexLayoutTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import XCTest
@testable import FlexLayout

@MainActor
final class FlexLayoutTests: XCTestCase {

func testRetainCycle() {
Expand Down
7 changes: 4 additions & 3 deletions Tests/FlexLayoutTests/InsetTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
import FlexLayout
import XCTest

final class InsetTests: XCTestCase {
@MainActor
final class InsetTests: XCTestCase, Sendable {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modify to allow testing of MainActor-isolated objects.


var viewController: UIViewController!
var rootFlexContainer: UIView!
var aView: UIView!

override func setUp() {
super.setUp()
override func setUp() async throws {
try await super.setUp()

viewController = UIViewController()

Expand Down
7 changes: 4 additions & 3 deletions Tests/FlexLayoutTests/JustifyContentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import FlexLayout
import XCTest

final class JustifyContentTests: XCTestCase {
@MainActor
final class JustifyContentTests: XCTestCase, Sendable {

var viewController: UIViewController!
var rootFlexContainer: UIView!
Expand All @@ -22,8 +23,8 @@ final class JustifyContentTests: XCTestCase {
var cView: UIView!
var dView: UIView!

override func setUp() {
super.setUp()
override func setUp() async throws {
try await super.setUp()

viewController = UIViewController()

Expand Down
7 changes: 4 additions & 3 deletions Tests/FlexLayoutTests/MarginTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
import FlexLayout
import XCTest

final class MarginTests: XCTestCase {
@MainActor
final class MarginTests: XCTestCase, Sendable {

var viewController: UIViewController!
var rootFlexContainer: UIView!
var aView: UIView!

override func setUp() {
super.setUp()
override func setUp() async throws {
try await super.setUp()

viewController = UIViewController()

Expand Down
7 changes: 4 additions & 3 deletions Tests/FlexLayoutTests/PaddingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
import FlexLayout
import XCTest

final class PaddingTests: XCTestCase {
@MainActor
final class PaddingTests: XCTestCase, Sendable {

var viewController: UIViewController!
var rootFlexContainer: UIView!
var aView: UIView!

override func setUp() {
super.setUp()
override func setUp() async throws {
try await super.setUp()

viewController = UIViewController()

Expand Down
7 changes: 4 additions & 3 deletions Tests/FlexLayoutTests/WidthSizeContentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
import FlexLayout
import XCTest

final class WidthSizeContentTests: XCTestCase {
@MainActor
final class WidthSizeContentTests: XCTestCase, Sendable {

var viewController: UIViewController!
var rootFlexContainer: UIView!
var aView: UIView!
var bView: UIView!
var cView: UIView!

override func setUp() {
super.setUp()
override func setUp() async throws {
try await super.setUp()

viewController = UIViewController()

Expand Down