Skip to content

Update yoga to 3.2.1 #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 20, 2025
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
8 changes: 4 additions & 4 deletions Example/cocoapods/FlexLayoutSample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
249EFE361E64FAFE00165E39 = {
isa = PBXGroup;
children = (
249EFE411E64FAFE00165E39 /* FlexLayoutSample */,
249EFE411E64FAFE00165E39 /* ../FlexLayoutSample */,
461884C59B72ACEAFC912B8A /* Frameworks */,
85CAAE97812075333AF3E88F /* Pods */,
249EFE401E64FAFE00165E39 /* Products */,
Expand All @@ -214,7 +214,7 @@
name = Products;
sourceTree = "<group>";
};
249EFE411E64FAFE00165E39 /* FlexLayoutSample */ = {
249EFE411E64FAFE00165E39 /* ../FlexLayoutSample */ = {
isa = PBXGroup;
children = (
2439CC671E66614D003326FB /* Supporting Files */,
Expand Down Expand Up @@ -664,7 +664,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
GCC_INPUT_FILETYPE = automatic;
INFOPLIST_FILE = "../FlexLayoutSample/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
PRODUCT_BUNDLE_IDENTIFIER = com.lucdion.FlexLayoutSample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -678,7 +678,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
GCC_INPUT_FILETYPE = automatic;
INFOPLIST_FILE = "../FlexLayoutSample/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
PRODUCT_BUNDLE_IDENTIFIER = com.lucdion.FlexLayoutSample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
4 changes: 2 additions & 2 deletions FlexLayout.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Pod::Spec.new do |spec|
spec.license = "MIT license"
spec.author = { "Luc Dion" => "luc_dion@yahoo.com" }

spec.platform = :ios, "14.0"
spec.platform = :ios, "13.4"
spec.source = { :git => "https://github.com/lucdion/FlexLayout.git", :tag => "#{spec.version}" }
spec.source_files = "Sources/**/*.{swift,h,m,mm,cpp,c}"
spec.public_header_files = "Sources/YogaKit/include/YogaKit/*.h"
Expand All @@ -24,5 +24,5 @@ Pod::Spec.new do |spec|
'-fPIC'
]

spec.dependency 'Yoga'
spec.dependency 'Yoga', '3.2.1'
end
4 changes: 4 additions & 0 deletions FlexLayout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
GENERATE_INFOPLIST_FILE = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.lucdion.FlexLayout;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -622,6 +623,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
GENERATE_INFOPLIST_FILE = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.lucdion.FlexLayout;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -640,6 +642,7 @@
DEVELOPMENT_TEAM = F37Y9H9E46;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.lucdion.FlexLayoutTests;
Expand All @@ -656,6 +659,7 @@
DEVELOPMENT_TEAM = F37Y9H9E46;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.lucdion.FlexLayoutTests;
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
.library(name: "FlexLayout", targets: ["FlexLayout"]),
],
dependencies: [
.package(url: "https://github.com/facebook/yoga.git", from: "3.1.0"),
.package(url: "https://github.com/facebook/yoga.git", .upToNextMinor(from: "3.2.1")),
],
targets: [
.target(
Expand Down
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
source 'https://cdn.cocoapods.org/'
use_frameworks!
platform :ios, '14.0'
platform :ios, '13.4'

workspace 'FlexLayout.xcworkspace'

target 'FlexLayout' do
pod 'Yoga', git: 'https://github.com/facebook/yoga.git', tag: 'v3.1.0'
pod 'Yoga'
end

target 'FlexLayoutTests' do
Expand Down
25 changes: 9 additions & 16 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,39 +1,32 @@
PODS:
- FlexLayout (2.0.10):
- Yoga
- FlexLayout (2.1.0):
- Yoga (= 3.2.1)
- PinLayout (1.10.5)
- SwiftLint (0.55.1)
- Yoga (3.1.0)
- Yoga (3.2.1)

DEPENDENCIES:
- FlexLayout (from `./`)
- PinLayout
- SwiftLint
- Yoga (from `https://github.com/facebook/yoga.git`, tag `v3.1.0`)
- Yoga

SPEC REPOS:
trunk:
- PinLayout
- SwiftLint
- Yoga

EXTERNAL SOURCES:
FlexLayout:
:path: "./"
Yoga:
:git: https://github.com/facebook/yoga.git
:tag: v3.1.0

CHECKOUT OPTIONS:
Yoga:
:git: https://github.com/facebook/yoga.git
:tag: v3.1.0

SPEC CHECKSUMS:
FlexLayout: aaf305c1f3203be3d8694c3835773d1e7a912b72
FlexLayout: 4832b2e2069002e7d3f48dffbb20cc773a1813be
PinLayout: f6c2b63a5a5b24864064e1d15c67de41b4e74748
SwiftLint: 3fe909719babe5537c552ee8181c0031392be933
Yoga: 955c6d6390d5b00fb54d02151e67d69b3ac6f2d8
Yoga: 636ce73bd247407928a7df089f3bc3675916b3ff

PODFILE CHECKSUM: 616cb577f11ab8498737680dedeed47c6fae4b64
PODFILE CHECKSUM: de7bb13eccf1a1ff875980af83b7d4a0cba2ca59

COCOAPODS: 1.16.2
COCOAPODS: 1.15.2
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,26 @@ FlexLayout automatically includes the UIView when:

Set the item display or not, with `none` value, the item will be hidden and not included in the layout.

Values:
* **`flex`**: Default value. The item is displayed normally and included in the layout.
* **`none`**: The item will be hidden and not included in the layout.
* **`contents`**: The node is removed from the layout flow, while its children are preserved and hoisted. This allows higher-level UI frameworks to compose wrapper components (e.g., to handle events) without influencing the layout of child nodes.

<br>

### boxSizing
- Applies to: `flex items`

**Method:**

* **`boxSizing(_: BoxSizing)`**

Set the box sizing mode for the item. This determines how the width and height of an element are calculated.

Values:
* **`borderBox`**: Default value. With `borderBox`, the specified dimensions (width, height) include the content, padding, and border. This means the overall size of the element is as defined, with padding and border accounted for inside.
* **`contentBox`**: With `contentBox`, the specified dimensions refer only to the content area. Padding and borders are added outside these dimensions, potentially increasing the total size of the element.

<br>

### markDirty()
Expand Down
45 changes: 33 additions & 12 deletions Sources/Swift/FlexLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ public final class Flex {

/**
Set all margins using UIEdgeInsets.
This method is particularly useful to set all margins using iOS 11 `UIView.safeAreaInsets`.
This method is particularly useful to set all margins using `UIView.safeAreaInsets`.
*/
@discardableResult
public func margin(_ insets: UIEdgeInsets) -> Flex {
Expand All @@ -904,11 +904,8 @@ public final class Flex {

/**
Set margins using NSDirectionalEdgeInsets.
This method is particularly to set all margins using iOS 11 `UIView.directionalLayoutMargins`.

Available only on iOS 11 and higher.
This method is particularly to set all margins using `UIView.directionalLayoutMargins`.
*/
@available(tvOS 11.0, iOS 11.0, *)
@discardableResult
public func margin(_ directionalInsets: NSDirectionalEdgeInsets) -> Flex {
yoga.marginTop = YGValue(directionalInsets.top)
Expand Down Expand Up @@ -1124,7 +1121,7 @@ public final class Flex {

/**
Set paddings using UIEdgeInsets.
This method is particularly useful to set all paddings using iOS 11 `UIView.safeAreaInsets`.
This method is particularly useful to set all paddings using `UIView.safeAreaInsets`.
*/
@discardableResult
public func padding(_ insets: UIEdgeInsets) -> Flex {
Expand All @@ -1137,11 +1134,8 @@ public final class Flex {

/**
Set paddings using NSDirectionalEdgeInsets.
This method is particularly to set all paddings using iOS 11 `UIView.directionalLayoutMargins`.

Available only on iOS 11 and higher.
This method is particularly to set all paddings using `UIView.directionalLayoutMargins`.
*/
@available(tvOS 11.0, iOS 11.0, *)
@discardableResult
public func padding(_ directionalInsets: NSDirectionalEdgeInsets) -> Flex {
yoga.paddingTop = YGValue(directionalInsets.top)
Expand Down Expand Up @@ -1334,7 +1328,20 @@ public final class Flex {
yoga.display = value.yogaValue
return self
}


//
// MARK: Box Sizing
//

/**
Set the box sizing
*/
@discardableResult
public func boxSizing(_ value: BoxSizing) -> Flex {
yoga.boxSizing = value.yogaValue
return self
}

// MARK: Enums

/**
Expand Down Expand Up @@ -1472,8 +1479,22 @@ public final class Flex {
case flex
/// With this value, the item will be hidden and not be calculated
case none
/// With this value, the node is removed from the layout flow, while its children are preserved and hoisted.
/// This allows higher-level UI frameworks to compose wrapper components (e.g., to handle events)
/// without influencing the layout of child nodes.
case contents
}


public enum BoxSizing {
/// Default value.
/// With `borderBox`, the specified dimensions (e.g., width, height) include the content, padding, and border.
/// This means the overall size of the element is as defined, with padding and border accounted for inside.
case borderBox
/// With `contentBox`, the specified dimensions refer only to the content area.
/// Padding and borders are added outside these dimensions, potentially increasing the total size of the element.
case contentBox
}

/*public enum Overflow {
/// Items that overflow
case visible
Expand Down
10 changes: 10 additions & 0 deletions Sources/Swift/Impl/FlexLayout+Enum.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ extension Flex.Display {
switch self {
case .flex: return YGDisplay.flex
case .none: return YGDisplay.none
case .contents: return YGDisplay.contents
}
}
}

extension Flex.BoxSizing {
var yogaValue: YGBoxSizing {
switch self {
case .borderBox: return YGBoxSizing.borderBox
case .contentBox: return YGBoxSizing.contentBox
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Sources/YogaKit/YGLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ - (void)setPosition:(YGPositionType)position {
YG_PROPERTY(YGWrap, flexWrap, FlexWrap)
YG_PROPERTY(YGOverflow, overflow, Overflow)
YG_PROPERTY(YGDisplay, display, Display)
YG_PROPERTY(YGBoxSizing, boxSizing, BoxSizing)

YG_PROPERTY(CGFloat, flex, Flex)
YG_PROPERTY(CGFloat, flexGrow, FlexGrow)
Expand Down
1 change: 1 addition & 0 deletions Sources/YogaKit/include/YogaKit/YGLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ typedef NS_OPTIONS(NSInteger, YGDimensionFlexibility) {
@property(nonatomic, readwrite, assign) YGWrap flexWrap;
@property(nonatomic, readwrite, assign) YGOverflow overflow;
@property(nonatomic, readwrite, assign) YGDisplay display;
@property(nonatomic, readwrite, assign) YGBoxSizing boxSizing;

@property(nonatomic, readwrite, assign) CGFloat flex;
@property(nonatomic, readwrite, assign) CGFloat flexGrow;
Expand Down