From 14f7e8bb2ceddefed6dfa2882d727872484cc507 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 13:24:14 +0800 Subject: [PATCH 01/38] [YogaKit] support auto apply layout. - support auto apply layout - build Yoga & YogaKit framework as staticlib; - update YogaKitSample. --- Yoga.podspec | 4 +- YogaKit.podspec | 3 +- YogaKit/Source/UIView+Yoga.h | 5 ++ YogaKit/Source/UIView+Yoga.m | 85 +++++++++++++++++++ YogaKit/Source/YGLayout.m | 46 ++++++++-- YogaKit/YogaKitSample/Podfile | 4 +- YogaKit/YogaKitSample/Podfile.lock | 37 ++++---- .../YogaKitSample.xcodeproj/project.pbxproj | 40 +++------ .../ExamplesViewController.swift | 29 ++++--- .../YogaKitSample/YogaKitSample/Info.plist | 2 + .../ViewControllers/BasicViewController.swift | 10 ++- .../LayoutInclusionViewController.swift | 10 +-- .../Views/SingleLabelCollectionCell.swift | 1 - 13 files changed, 200 insertions(+), 76 deletions(-) diff --git a/Yoga.podspec b/Yoga.podspec index 2b09977d..76244f65 100644 --- a/Yoga.podspec +++ b/Yoga.podspec @@ -5,7 +5,7 @@ Pod::Spec.new do |spec| spec.name = 'Yoga' - spec.version = '1.14.0' + spec.version = '1.14.1' spec.license = { :type => 'MIT', :file => "LICENSE" } spec.homepage = 'https://yogalayout.com/' spec.documentation_url = 'https://yogalayout.com/docs' @@ -34,5 +34,5 @@ Pod::Spec.new do |spec| ] spec.source_files = 'yoga/**/*.{c,h,cpp}' spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGNode,YGStyle,YGValue}.h' - + spec.static_framework = true end diff --git a/YogaKit.podspec b/YogaKit.podspec index 4fee15ec..042d1b11 100644 --- a/YogaKit.podspec +++ b/YogaKit.podspec @@ -23,7 +23,7 @@ podspec = Pod::Spec.new do |spec| spec.ios.deployment_target = '8.0' spec.ios.frameworks = 'UIKit' spec.module_name = 'YogaKit' - spec.dependency 'Yoga', '~> 1.14' + spec.dependency 'Yoga', '~> 1.14.1' # Fixes the bug related the xcode 11 not able to find swift related frameworks. # https://github.com/Carthage/Carthage/issues/2825 # https://twitter.com/krzyzanowskim/status/1151549874653081601?s=21 @@ -32,6 +32,7 @@ podspec = Pod::Spec.new do |spec| spec.public_header_files = 'YogaKit/Source/{YGLayout,UIView+Yoga}.h' spec.private_header_files = 'YogaKit/Source/YGLayout+Private.h' spec.swift_version = '5.1' + spec.static_framework = true end # See https://github.com/facebook/yoga/pull/366 diff --git a/YogaKit/Source/UIView+Yoga.h b/YogaKit/Source/UIView+Yoga.h index 4c85dcc4..fb730c38 100644 --- a/YogaKit/Source/UIView+Yoga.h +++ b/YogaKit/Source/UIView+Yoga.h @@ -34,4 +34,9 @@ typedef void (^YGLayoutConfigurationBlock)(YGLayout* layout); @end + +@interface UIView (YogaKitAutoApplyLayout) + +@end + NS_ASSUME_NONNULL_END diff --git a/YogaKit/Source/UIView+Yoga.m b/YogaKit/Source/UIView+Yoga.m index e472c9c7..117ae319 100644 --- a/YogaKit/Source/UIView+Yoga.m +++ b/YogaKit/Source/UIView+Yoga.m @@ -35,3 +35,88 @@ static const void* kYGYogaAssociatedKey = &kYGYogaAssociatedKey; } @end + + +static const void* kYGBoundsSizeAssociatedKey = &kYGBoundsSizeAssociatedKey; +static void YogaSwizzleInstanceMethod(Class cls, SEL originalSelector, SEL swizzledSelector); + +@implementation UIView (YogaKitAutoApplyLayout) + ++ (void)load { + static dispatch_once_t onceToken = 0; + dispatch_once(&onceToken, ^{ + YogaSwizzleInstanceMethod(self, @selector(initWithFrame:), @selector(_yoga_initWithFrame:)); + YogaSwizzleInstanceMethod(self, @selector(setFrame:), @selector(_yoga_setFrame:)); + YogaSwizzleInstanceMethod(self, @selector(setBounds:), @selector(_yoga_setBounds:)); + }); +} + +- (CGSize)_yoga_boundsSize { + NSValue *value = (NSValue *)objc_getAssociatedObject(self, kYGBoundsSizeAssociatedKey); + + return value ? value.CGSizeValue : CGSizeMake(YGUndefined, YGUndefined); +} + +- (void)set_yoga_boundsSize:(CGSize)size { + objc_setAssociatedObject(self, + kYGBoundsSizeAssociatedKey, + [NSValue valueWithCGSize:size], + OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (instancetype)_yoga_initWithFrame:(CGRect)frame { + id _self = [self _yoga_initWithFrame:frame]; + if (_self) { + [self _yoga_applyLayout]; + } + + return _self; +} + +- (void)_yoga_setFrame:(CGRect)frame { + [self _yoga_setFrame:frame]; + + [self _yoga_applyLayout]; +} + +- (void)_yoga_setBounds:(CGRect)bounds { + [self _yoga_setBounds:bounds]; + + [self _yoga_applyLayout]; +} + +- (void)_yoga_applyLayout { + if (self.isYogaEnabled && self.yoga.isEnabled) { + CGSize size = self.bounds.size; + CGSize prev = self._yoga_boundsSize; + if (!CGSizeEqualToSize(size, prev)) { + self._yoga_boundsSize = size; + [self.yoga applyLayoutPreservingOrigin:YES]; + } + } +} + +@end + + +static void YogaSwizzleInstanceMethod(Class cls, SEL originalSelector, SEL swizzledSelector) { + if (!cls || !originalSelector || !swizzledSelector) { + return; + } + + Method originalMethod = class_getInstanceMethod(cls, originalSelector); + Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector); + if (!originalMethod || !swizzledMethod) { + return; + } + + IMP swizzledIMP = method_getImplementation(swizzledMethod); + if (class_addMethod(cls, originalSelector, swizzledIMP, method_getTypeEncoding(swizzledMethod))) { + class_replaceMethod(cls, + swizzledSelector, + method_getImplementation(originalMethod), + method_getTypeEncoding(originalMethod)); + } else { + method_exchangeImplementations(originalMethod, swizzledMethod); + } +} diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 4a95a5ca..c64a30ea 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -162,6 +162,7 @@ static YGConfigRef globalConfig; @property(nonatomic, weak, readonly) UIView* view; @property(nonatomic, assign, readonly) BOOL isUIView; +@property(nonatomic, assign) BOOL isApplingLayout; @end @@ -292,11 +293,19 @@ YG_PROPERTY(CGFloat, aspectRatio, AspectRatio) } - (void)applyLayout { + if (self.isApplingLayout) { + return; + } + [self calculateLayoutWithSize:self.view.bounds.size]; YGApplyLayoutToViewHierarchy(self.view, NO); } - (void)applyLayoutPreservingOrigin:(BOOL)preserveOrigin { + if (self.isApplingLayout) { + return; + } + [self calculateLayoutWithSize:self.view.bounds.size]; YGApplyLayoutToViewHierarchy(self.view, preserveOrigin); } @@ -304,6 +313,10 @@ YG_PROPERTY(CGFloat, aspectRatio, AspectRatio) - (void)applyLayoutPreservingOrigin:(BOOL)preserveOrigin dimensionFlexibility: (YGDimensionFlexibility)dimensionFlexibility { + if (self.isApplingLayout) { + return; + } + CGSize size = self.view.bounds.size; if (dimensionFlexibility & YGDimensionFlexibilityFlexibleWidth) { size.width = YGUndefined; @@ -463,12 +476,22 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { [NSThread isMainThread], @"Framesetting should only be done on the main thread."); + if (!view.isYogaEnabled || !view.yoga.isEnabled) { + return; + } + const YGLayout* yoga = view.yoga; + if (yoga.isApplingLayout) { + return; + } + if (!yoga.isIncludedInLayout) { return; } + yoga.isApplingLayout = YES; + YGNodeRef node = yoga.node; const CGPoint topLeft = { YGNodeLayoutGetLeft(node), @@ -481,7 +504,7 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { }; const CGPoint origin = preserveOrigin ? view.frame.origin : CGPointZero; - view.frame = (CGRect){ + CGRect frame = (CGRect){ .origin = { .x = YGRoundPixelValue(topLeft.x + origin.x), @@ -489,18 +512,31 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { }, .size = { - .width = YGRoundPixelValue(bottomRight.x) - - YGRoundPixelValue(topLeft.x), - .height = YGRoundPixelValue(bottomRight.y) - - YGRoundPixelValue(topLeft.y), + .width = MAX(YGRoundPixelValue(bottomRight.x) - + YGRoundPixelValue(topLeft.x), 0), + .height = MAX(YGRoundPixelValue(bottomRight.y) - + YGRoundPixelValue(topLeft.y), 0), }, }; + // use bounds/center and not frame if non-identity transform. + view.bounds = (CGRect) { + .origin = view.bounds.origin, + .size = frame.size + }; + + view.center = (CGPoint) { + .x = YGRoundPixelValue(CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5), + .y = YGRoundPixelValue(CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5) + }; + if (!yoga.isLeaf) { for (NSUInteger i = 0; i < view.subviews.count; i++) { YGApplyLayoutToViewHierarchy(view.subviews[i], NO); } } + + yoga.isApplingLayout = NO; } @end diff --git a/YogaKit/YogaKitSample/Podfile b/YogaKit/YogaKitSample/Podfile index ab7eca4d..e5e98666 100644 --- a/YogaKit/YogaKitSample/Podfile +++ b/YogaKit/YogaKitSample/Podfile @@ -1,6 +1,8 @@ +platform :ios, '9.0' use_frameworks! target 'YogaKitSample' do + pod 'Yoga', :path => '../../Yoga.podspec' pod 'YogaKit', :path => '../../YogaKit.podspec' - pod 'IGListKit', '~> 2.1.0' + pod 'IGListKit', '~> 4.0.0' end diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index 8600fade..a66202ea 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -1,26 +1,33 @@ PODS: - - IGListKit (2.1.0): - - IGListKit/Default (= 2.1.0) - - IGListKit/Default (2.1.0): - - IGListKit/Diffing - - IGListKit/Diffing (2.1.0) - - Yoga (1.7.0) - - YogaKit (1.7.0): - - Yoga (~> 1.7) + - IGListDiffKit (4.0.0) + - IGListKit (4.0.0): + - IGListDiffKit (= 4.0.0) + - Yoga (1.14.1) + - YogaKit (1.18.1): + - Yoga (~> 1.14.1) DEPENDENCIES: - - IGListKit (~> 2.1.0) + - IGListKit (~> 4.0.0) + - Yoga (from `../../Yoga.podspec`) - YogaKit (from `../../YogaKit.podspec`) +SPEC REPOS: + trunk: + - IGListDiffKit + - IGListKit + EXTERNAL SOURCES: + Yoga: + :path: "../../Yoga.podspec" YogaKit: - :path: ../../YogaKit.podspec + :path: "../../YogaKit.podspec" SPEC CHECKSUMS: - IGListKit: b826c68ef7a4ae1626c09d4d3e1ea7a169e6c36e - Yoga: 2ed1d7accfef3610a67f58c0cf101a0662137f2c - YogaKit: 31576530e8fcae3175469719ec3212397403330b + IGListDiffKit: 665d6cf43ce726e676013db9c7d6c4294259b6b2 + IGListKit: fd5a5d21935298f5849fa49d426843cff97b77c7 + Yoga: 1b62f19e549f5e174fc935ba76a47a8d9b60211e + YogaKit: befe87ed72becf4125f290a33af021e9992712c7 -PODFILE CHECKSUM: 216f8e7127767709e0e43f3711208d238fa5c404 +PODFILE CHECKSUM: 31f0f3ccdee77adc2f4b58b4772186c206fd1446 -COCOAPODS: 1.1.1 +COCOAPODS: 1.9.1 diff --git a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj index 01b15da3..7094eefa 100644 --- a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj @@ -1,10 +1,3 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - // !$*UTF8*$! { archiveVersion = 1; @@ -178,7 +171,6 @@ 13687D401DF8748300E7C260 /* Frameworks */, 13687D411DF8748300E7C260 /* Resources */, FA2FB9DD6471BDD3FBCE503B /* [CP] Embed Pods Frameworks */, - 6E01EB987F1564F3D71EBE5A /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -233,6 +225,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -272,28 +265,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-YogaKitSample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 6E01EB987F1564F3D71EBE5A /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; FA2FB9DD6471BDD3FBCE503B /* [CP] Embed Pods Frameworks */ = { @@ -302,13 +283,18 @@ files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/IGListDiffKit/IGListDiffKit.framework", + "${BUILT_PRODUCTS_DIR}/IGListKit/IGListKit.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IGListDiffKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IGListKit.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -446,7 +432,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_INSTALL_OBJC_HEADER = NO; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -461,7 +447,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_INSTALL_OBJC_HEADER = NO; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/YogaKit/YogaKitSample/YogaKitSample/ExamplesViewController.swift b/YogaKit/YogaKitSample/YogaKitSample/ExamplesViewController.swift index c46f0dd6..f7a19d56 100644 --- a/YogaKit/YogaKitSample/YogaKitSample/ExamplesViewController.swift +++ b/YogaKit/YogaKitSample/YogaKitSample/ExamplesViewController.swift @@ -18,12 +18,12 @@ private final class ExampleModel { } } -extension ExampleModel: IGListDiffable { +extension ExampleModel: ListDiffable { fileprivate func diffIdentifier() -> NSObjectProtocol { return title as NSString } - fileprivate func isEqual(toDiffableObject object: IGListDiffable?) -> Bool { + fileprivate func isEqual(toDiffableObject object: ListDiffable?) -> Bool { guard let otherObj = object as? ExampleModel else { return false } return (title == otherObj.title) && @@ -31,11 +31,11 @@ extension ExampleModel: IGListDiffable { } } -final class ExamplesViewController: UIViewController, IGListAdapterDataSource, IGListSingleSectionControllerDelegate { - private lazy var adapter: IGListAdapter = { - return IGListAdapter(updater: IGListAdapterUpdater(), viewController: self, workingRangeSize: 0) +final class ExamplesViewController: UIViewController, ListAdapterDataSource, ListSingleSectionControllerDelegate { + private lazy var adapter: ListAdapter = { + return ListAdapter(updater: ListAdapterUpdater(), viewController: self, workingRangeSize: 0) }() - private let collectionView = IGListCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) + private let collectionView = ListCollectionView(frame: .zero) // Update this to array to create more examples. @@ -47,6 +47,7 @@ final class ExamplesViewController: UIViewController, IGListAdapterDataSource, I override func viewDidLoad() { super.viewDidLoad() title = "Examples" + collectionView.backgroundColor = .clear view.addSubview(collectionView) adapter.collectionView = collectionView adapter.dataSource = self @@ -59,16 +60,16 @@ final class ExamplesViewController: UIViewController, IGListAdapterDataSource, I //MARK: IGListAdapterDataSource - func objects(for listAdapter: IGListAdapter) -> [IGListDiffable] { - return models as [IGListDiffable] + func objects(for listAdapter: ListAdapter) -> [ListDiffable] { + return models as [ListDiffable] } - func listAdapter(_ listAdapter: IGListAdapter, sectionControllerFor object: Any) -> IGListSectionController { - let sizeBlock: IGListSingleSectionCellSizeBlock = { (model, context) in + func listAdapter(_ listAdapter: ListAdapter, sectionControllerFor object: Any) -> ListSectionController { + let sizeBlock: ListSingleSectionCellSizeBlock = { (model, context) in return CGSize(width: (context?.containerSize.width)!, height: 75.0) } - let configureBlock: IGListSingleSectionCellConfigureBlock = { (model, cell) in + let configureBlock: ListSingleSectionCellConfigureBlock = { (model, cell) in guard let m = model as? ExampleModel, let c = cell as? SingleLabelCollectionCell else { return } @@ -76,18 +77,18 @@ final class ExamplesViewController: UIViewController, IGListAdapterDataSource, I c.label.text = m.title } - let sectionController = IGListSingleSectionController(cellClass: SingleLabelCollectionCell.self, + let sectionController = ListSingleSectionController(cellClass: SingleLabelCollectionCell.self, configureBlock: configureBlock, sizeBlock: sizeBlock) sectionController.selectionDelegate = self return sectionController } - func emptyView(for listAdapter: IGListAdapter) -> UIView? { return nil } + func emptyView(for listAdapter: ListAdapter) -> UIView? { return nil } //MARK: IGListSingleSectionControllerDelegate - func didSelect(_ sectionController: IGListSingleSectionController) { + func didSelect(_ sectionController: ListSingleSectionController, with object: Any) { let section = adapter.section(for: sectionController) let model = models[section] diff --git a/YogaKit/YogaKitSample/YogaKitSample/Info.plist b/YogaKit/YogaKitSample/YogaKitSample/Info.plist index 22ca2cd4..c15be7ff 100644 --- a/YogaKit/YogaKitSample/YogaKitSample/Info.plist +++ b/YogaKit/YogaKitSample/YogaKitSample/Info.plist @@ -32,5 +32,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIUserInterfaceStyle + Light diff --git a/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/BasicViewController.swift b/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/BasicViewController.swift index 07059f1f..9637baef 100644 --- a/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/BasicViewController.swift +++ b/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/BasicViewController.swift @@ -32,22 +32,24 @@ final class BasicViewController: UIViewController { } root.addSubview(child1) - let child2 = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 200)) + let child2 = UIView() child2.backgroundColor = .green child2.configureLayout { (layout) in layout.isEnabled = true layout.alignSelf = .flexEnd + layout.width = 200 + layout.height = 200 } root.addSubview(child2) - let child3 = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) + let child3 = UIView() child3.backgroundColor = .yellow child3.configureLayout { (layout) in layout.isEnabled = true layout.alignSelf = .flexStart + layout.width = 100 + layout.height = 100 } root.addSubview(child3) - - root.yoga.applyLayout(preservingOrigin: true) } } diff --git a/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/LayoutInclusionViewController.swift b/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/LayoutInclusionViewController.swift index 897b8590..ced3693f 100644 --- a/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/LayoutInclusionViewController.swift +++ b/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/LayoutInclusionViewController.swift @@ -51,9 +51,9 @@ final class LayoutInclusionViewController: UIViewController { } contentView.addSubview(disappearingView) - button.setTitle("Add Blue View", for: UIControlState.selected) - button.setTitle("Remove Blue View", for: UIControlState.normal) - button.addTarget(self, action: #selector(buttonWasTapped), for: UIControlEvents.touchUpInside) + button.setTitle("Add Blue View", for: .selected) + button.setTitle("Remove Blue View", for: .normal) + button.addTarget(self, action: #selector(buttonWasTapped), for: UIControl.Event.touchUpInside) button.configureLayout { (layout) in layout.isEnabled = true layout.height = 300 @@ -61,12 +61,10 @@ final class LayoutInclusionViewController: UIViewController { layout.alignSelf = .center } root.addSubview(button) - - root.yoga.applyLayout(preservingOrigin: false) } // MARK - UIButton Action - func buttonWasTapped() { + @objc func buttonWasTapped() { button.isSelected = !button.isSelected button.isUserInteractionEnabled = false diff --git a/YogaKit/YogaKitSample/YogaKitSample/Views/SingleLabelCollectionCell.swift b/YogaKit/YogaKitSample/YogaKitSample/Views/SingleLabelCollectionCell.swift index 50fa9042..19ec7006 100644 --- a/YogaKit/YogaKitSample/YogaKitSample/Views/SingleLabelCollectionCell.swift +++ b/YogaKit/YogaKitSample/YogaKitSample/Views/SingleLabelCollectionCell.swift @@ -42,7 +42,6 @@ final class SingleLabelCollectionCell: UICollectionViewCell { override func layoutSubviews() { super.layoutSubviews() - contentView.yoga.applyLayout(preservingOrigin: false) label.frame = contentView.bounds } } -- 2.50.1.windows.1 From 6bf096294d424bc3cf361d9693cac3704a95a90e Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 13:37:29 +0800 Subject: [PATCH 02/38] [YogaKit] update Pod Spec version to 1.18.2 --- YogaKit.podspec | 2 +- YogaKit/YogaKitSample/Podfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/YogaKit.podspec b/YogaKit.podspec index 042d1b11..7ee2569b 100644 --- a/YogaKit.podspec +++ b/YogaKit.podspec @@ -5,7 +5,7 @@ podspec = Pod::Spec.new do |spec| spec.name = 'YogaKit' - spec.version = '1.18.1' + spec.version = '1.18.2' spec.license = { :type => 'MIT', :file => "LICENSE" } spec.homepage = 'https://facebook.github.io/yoga/' spec.documentation_url = 'https://facebook.github.io/yoga/docs/' diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index a66202ea..a42e6002 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -3,7 +3,7 @@ PODS: - IGListKit (4.0.0): - IGListDiffKit (= 4.0.0) - Yoga (1.14.1) - - YogaKit (1.18.1): + - YogaKit (1.18.2): - Yoga (~> 1.14.1) DEPENDENCIES: @@ -26,7 +26,7 @@ SPEC CHECKSUMS: IGListDiffKit: 665d6cf43ce726e676013db9c7d6c4294259b6b2 IGListKit: fd5a5d21935298f5849fa49d426843cff97b77c7 Yoga: 1b62f19e549f5e174fc935ba76a47a8d9b60211e - YogaKit: befe87ed72becf4125f290a33af021e9992712c7 + YogaKit: fa5270a9482b444b2f42e2ab92fdbd03854a97f3 PODFILE CHECKSUM: 31f0f3ccdee77adc2f4b58b4772186c206fd1446 -- 2.50.1.windows.1 From aa11f6a4db8ac9e3060b2dcf120b39aa3fdb1853 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 14:09:58 +0800 Subject: [PATCH 03/38] [YogaKit] use bounds/center and not frame if non-identity transform. --- YogaKit/Source/YGLayout.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index c64a30ea..a32a6008 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -503,7 +503,12 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { topLeft.y + YGNodeLayoutGetHeight(node), }; - const CGPoint origin = preserveOrigin ? view.frame.origin : CGPointZero; + // use bounds/center and not frame if non-identity transform. + const CGPoint origin = preserveOrigin ? (CGPoint) { + .x = view.center.x - CGRectGetWidth(view.bounds) * 0.5, + .y = view.center.y - CGRectGetHeight(view.bounds) * 0.5 + } + : CGPointZero; CGRect frame = (CGRect){ .origin = { @@ -519,7 +524,6 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { }, }; - // use bounds/center and not frame if non-identity transform. view.bounds = (CGRect) { .origin = view.bounds.origin, .size = frame.size -- 2.50.1.windows.1 From b78cfa669819296f88c3e61ab9e9495df3ecbfe2 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 14:25:57 +0800 Subject: [PATCH 04/38] [YogaKit] ignore margin for yoga root view. fix issue 1023: https://github.com/facebook/yoga/issues/1023 --- YogaKit/Source/YGLayout.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index a32a6008..e31e238f 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -493,10 +493,11 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { yoga.isApplingLayout = YES; YGNodeRef node = yoga.node; - const CGPoint topLeft = { - YGNodeLayoutGetLeft(node), - YGNodeLayoutGetTop(node), - }; + + const CGPoint topLeft = (view.superview.isYogaEnabled && view.superview.yoga.isEnabled) ? (CGPoint) { + .x = YGNodeLayoutGetLeft(node), + .y = YGNodeLayoutGetTop(node) + } : CGPointZero; const CGPoint bottomRight = { topLeft.x + YGNodeLayoutGetWidth(node), -- 2.50.1.windows.1 From ae3aa9582cb8ea85b135c64476f5d2ab36273bc0 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 17:17:15 +0800 Subject: [PATCH 05/38] [YogaKit] add unit tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - pixel-align for view’s frame; - add unit tests for YogaKit. --- YogaKit/Source/UIView+Yoga.m | 2 +- YogaKit/Source/YGLayout.m | 12 +- YogaKit/YogaKitSample/Podfile | 11 +- YogaKit/YogaKitSample/Podfile.lock | 2 +- .../YogaKitSample.xcodeproj/project.pbxproj | 159 +++++++++++++++--- .../YogaKitSampleTests/dummy.swift | 1 + 6 files changed, 147 insertions(+), 40 deletions(-) create mode 100644 YogaKit/YogaKitSample/YogaKitSampleTests/dummy.swift diff --git a/YogaKit/Source/UIView+Yoga.m b/YogaKit/Source/UIView+Yoga.m index 117ae319..e6c16352 100644 --- a/YogaKit/Source/UIView+Yoga.m +++ b/YogaKit/Source/UIView+Yoga.m @@ -43,7 +43,7 @@ static void YogaSwizzleInstanceMethod(Class cls, SEL originalSelector, SEL swizz @implementation UIView (YogaKitAutoApplyLayout) + (void)load { - static dispatch_once_t onceToken = 0; + static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ YogaSwizzleInstanceMethod(self, @selector(initWithFrame:), @selector(_yoga_initWithFrame:)); YogaSwizzleInstanceMethod(self, @selector(setFrame:), @selector(_yoga_setFrame:)); diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index e31e238f..36c22d37 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -468,7 +468,7 @@ static CGFloat YGRoundPixelValue(CGFloat value) { scale = [UIScreen mainScreen].scale; }); - return roundf(value * scale) / scale; + return ceil(value * scale) / scale; // Pixel-align } static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { @@ -513,15 +513,13 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { CGRect frame = (CGRect){ .origin = { - .x = YGRoundPixelValue(topLeft.x + origin.x), - .y = YGRoundPixelValue(topLeft.y + origin.y), + .x = topLeft.x + origin.x, + .y = topLeft.y + origin.y, }, .size = { - .width = MAX(YGRoundPixelValue(bottomRight.x) - - YGRoundPixelValue(topLeft.x), 0), - .height = MAX(YGRoundPixelValue(bottomRight.y) - - YGRoundPixelValue(topLeft.y), 0), + .width = MAX(YGRoundPixelValue(bottomRight.x - topLeft.x), 0), + .height = MAX(YGRoundPixelValue(bottomRight.y - topLeft.y), 0), }, }; diff --git a/YogaKit/YogaKitSample/Podfile b/YogaKit/YogaKitSample/Podfile index e5e98666..c399a1d8 100644 --- a/YogaKit/YogaKitSample/Podfile +++ b/YogaKit/YogaKitSample/Podfile @@ -1,8 +1,11 @@ platform :ios, '9.0' use_frameworks! -target 'YogaKitSample' do - pod 'Yoga', :path => '../../Yoga.podspec' - pod 'YogaKit', :path => '../../YogaKit.podspec' - pod 'IGListKit', '~> 4.0.0' +targetsArray = ['YogaKitSample', 'YogaKitSampleTests'] +targetsArray.each do |t| + target t do + pod 'Yoga', :path => '../../Yoga.podspec' + pod 'YogaKit', :path => '../../YogaKit.podspec' + pod 'IGListKit', '~> 4.0.0' + end end diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index a42e6002..fe638ba8 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -28,6 +28,6 @@ SPEC CHECKSUMS: Yoga: 1b62f19e549f5e174fc935ba76a47a8d9b60211e YogaKit: fa5270a9482b444b2f42e2ab92fdbd03854a97f3 -PODFILE CHECKSUM: 31f0f3ccdee77adc2f4b58b4772186c206fd1446 +PODFILE CHECKSUM: 88aca7a173462716bce24678d37a225fcff1c193 COCOAPODS: 1.9.1 diff --git a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj index 7094eefa..9fd0cf31 100644 --- a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj @@ -10,7 +10,10 @@ 13687D531DF8748400E7C260 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13687D521DF8748400E7C260 /* Assets.xcassets */; }; 13687D851DF87D1E00E7C260 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D841DF87D1E00E7C260 /* UIKit.framework */; }; 13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D861DF87D2400E7C260 /* Foundation.framework */; }; + 151960FA24E5314C00F7BF06 /* YogaKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 151960F924E5314C00F7BF06 /* YogaKitTests.m */; }; + 151960FC24E532B700F7BF06 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 151960FB24E532B700F7BF06 /* dummy.swift */; }; 15A7CB5995C9DAB1C8803834 /* Pods_YogaKitSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */; }; + 1D885DC3D17809A4C3E245F3 /* Pods_YogaKitSampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB0C63590A97352D30E310E /* Pods_YogaKitSampleTests.framework */; }; 40BD9F461E477A09002790A9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F451E477A09002790A9 /* AppDelegate.swift */; }; 40BD9F4B1E47850C002790A9 /* BasicViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F4A1E47850C002790A9 /* BasicViewController.swift */; }; 40BD9F501E479079002790A9 /* SingleLabelCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F4F1E479079002790A9 /* SingleLabelCollectionCell.swift */; }; @@ -19,7 +22,7 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 638A94541E215CC800A726AD /* PBXContainerItemProxy */ = { + 151960F424E530E700F7BF06 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 13687D3B1DF8748300E7C260 /* Project object */; proxyType = 1; @@ -57,15 +60,20 @@ 13687D571DF8748400E7C260 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 13687D841DF87D1E00E7C260 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 13687D861DF87D2400E7C260 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 151960F924E5314C00F7BF06 /* YogaKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = YogaKitTests.m; path = ../../Tests/YogaKitTests.m; sourceTree = ""; }; + 151960FB24E532B700F7BF06 /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = ""; }; 1D2FF4D5FCA6A8C54A4074A3 /* Pods-YogaKitSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample.debug.xcconfig"; sourceTree = ""; }; 40BD9F451E477A09002790A9 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40BD9F4A1E47850C002790A9 /* BasicViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BasicViewController.swift; path = ViewControllers/BasicViewController.swift; sourceTree = ""; }; 40BD9F4F1E479079002790A9 /* SingleLabelCollectionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SingleLabelCollectionCell.swift; path = Views/SingleLabelCollectionCell.swift; sourceTree = ""; }; 40BD9F511E479173002790A9 /* LayoutInclusionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LayoutInclusionViewController.swift; path = ViewControllers/LayoutInclusionViewController.swift; sourceTree = ""; }; + 4BB0C63590A97352D30E310E /* Pods_YogaKitSampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitSampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 638A94471E1F06D100A726AD /* ExamplesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExamplesViewController.swift; sourceTree = ""; }; - 638A944F1E215CC800A726AD /* YogaKitSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample.release.xcconfig"; sourceTree = ""; }; + A26128CF4F9CAE93983FF74F /* Pods-YogaKitSampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests.debug.xcconfig"; sourceTree = ""; }; C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FF607399A6E2DE06593D1FA8 /* Pods-YogaKitSampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -79,10 +87,11 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 638A944C1E215CC800A726AD /* Frameworks */ = { + 151960EC24E530E700F7BF06 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1D885DC3D17809A4C3E245F3 /* Pods_YogaKitSampleTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -93,6 +102,7 @@ isa = PBXGroup; children = ( 13687D451DF8748400E7C260 /* YogaKitSample */, + 151960F024E530E700F7BF06 /* YogaKitSampleTests */, 13687D441DF8748400E7C260 /* Products */, 13687D831DF87D1E00E7C260 /* Frameworks */, E1C759E3C8E84821213ECE8D /* Pods */, @@ -103,7 +113,7 @@ isa = PBXGroup; children = ( 13687D431DF8748400E7C260 /* YogaKitSample.app */, - 638A944F1E215CC800A726AD /* YogaKitSampleTests.xctest */, + 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */, ); name = Products; sourceTree = ""; @@ -127,10 +137,20 @@ 13687D861DF87D2400E7C260 /* Foundation.framework */, 13687D841DF87D1E00E7C260 /* UIKit.framework */, C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */, + 4BB0C63590A97352D30E310E /* Pods_YogaKitSampleTests.framework */, ); name = Frameworks; sourceTree = ""; }; + 151960F024E530E700F7BF06 /* YogaKitSampleTests */ = { + isa = PBXGroup; + children = ( + 151960F924E5314C00F7BF06 /* YogaKitTests.m */, + 151960FB24E532B700F7BF06 /* dummy.swift */, + ); + path = YogaKitSampleTests; + sourceTree = ""; + }; 40BD9F481E4784B3002790A9 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -153,6 +173,8 @@ children = ( 1D2FF4D5FCA6A8C54A4074A3 /* Pods-YogaKitSample.debug.xcconfig */, 82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */, + A26128CF4F9CAE93983FF74F /* Pods-YogaKitSampleTests.debug.xcconfig */, + FF607399A6E2DE06593D1FA8 /* Pods-YogaKitSampleTests.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -181,22 +203,24 @@ productReference = 13687D431DF8748400E7C260 /* YogaKitSample.app */; productType = "com.apple.product-type.application"; }; - 638A944E1E215CC800A726AD /* YogaKitSampleTests */ = { + 151960EE24E530E700F7BF06 /* YogaKitSampleTests */ = { isa = PBXNativeTarget; - buildConfigurationList = 638A94561E215CC800A726AD /* Build configuration list for PBXNativeTarget "YogaKitSampleTests" */; + buildConfigurationList = 151960F624E530E700F7BF06 /* Build configuration list for PBXNativeTarget "YogaKitSampleTests" */; buildPhases = ( - 638A944B1E215CC800A726AD /* Sources */, - 638A944C1E215CC800A726AD /* Frameworks */, - 638A944D1E215CC800A726AD /* Resources */, + 6762F7581996BBCD3BC8BC43 /* [CP] Check Pods Manifest.lock */, + 151960EB24E530E700F7BF06 /* Sources */, + 151960EC24E530E700F7BF06 /* Frameworks */, + 151960ED24E530E700F7BF06 /* Resources */, + 1883DD5DF55125032E2DEF71 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); dependencies = ( - 638A94551E215CC800A726AD /* PBXTargetDependency */, + 151960F524E530E700F7BF06 /* PBXTargetDependency */, ); name = YogaKitSampleTests; productName = YogaKitSampleTests; - productReference = 638A944F1E215CC800A726AD /* YogaKitSampleTests.xctest */; + productReference = 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ @@ -213,8 +237,9 @@ LastSwiftMigration = 0820; ProvisioningStyle = Automatic; }; - 638A944E1E215CC800A726AD = { - CreatedOnToolsVersion = 8.2.1; + 151960EE24E530E700F7BF06 = { + CreatedOnToolsVersion = 11.6; + LastSwiftMigration = 1160; ProvisioningStyle = Automatic; TestTargetID = 13687D421DF8748300E7C260; }; @@ -235,7 +260,7 @@ projectRoot = ""; targets = ( 13687D421DF8748300E7C260 /* YogaKitSample */, - 638A944E1E215CC800A726AD /* YogaKitSampleTests */, + 151960EE24E530E700F7BF06 /* YogaKitSampleTests */, ); }; /* End PBXProject section */ @@ -249,7 +274,7 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 638A944D1E215CC800A726AD /* Resources */ = { + 151960ED24E530E700F7BF06 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -259,6 +284,26 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 1883DD5DF55125032E2DEF71 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/IGListDiffKit/IGListDiffKit.framework", + "${BUILT_PRODUCTS_DIR}/IGListKit/IGListKit.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IGListDiffKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IGListKit.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 513B543F92B2E4F4D1EE1CE7 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -277,6 +322,28 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + 6762F7581996BBCD3BC8BC43 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-YogaKitSampleTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; FA2FB9DD6471BDD3FBCE503B /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -312,20 +379,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 638A944B1E215CC800A726AD /* Sources */ = { + 151960EB24E530E700F7BF06 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 151960FC24E532B700F7BF06 /* dummy.swift in Sources */, + 151960FA24E5314C00F7BF06 /* YogaKitTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 638A94551E215CC800A726AD /* PBXTargetDependency */ = { + 151960F524E530E700F7BF06 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 13687D421DF8748300E7C260 /* YogaKitSample */; - targetProxy = 638A94541E215CC800A726AD /* PBXContainerItemProxy */; + targetProxy = 151960F424E530E700F7BF06 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -451,30 +520,66 @@ }; name = Release; }; - 638A94571E215CC800A726AD /* Debug */ = { + 151960F724E530E700F7BF06 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = A26128CF4F9CAE93983FF74F /* Pods-YogaKitSampleTests.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; - INFOPLIST_FILE = YogaKitSampleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YogaKitSample.app/YogaKitSample"; }; name = Debug; }; - 638A94581E215CC800A726AD /* Release */ = { + 151960F824E530E700F7BF06 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = FF607399A6E2DE06593D1FA8 /* Pods-YogaKitSampleTests.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; - INFOPLIST_FILE = YogaKitSampleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YogaKitSample.app/YogaKitSample"; }; name = Release; @@ -500,11 +605,11 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 638A94561E215CC800A726AD /* Build configuration list for PBXNativeTarget "YogaKitSampleTests" */ = { + 151960F624E530E700F7BF06 /* Build configuration list for PBXNativeTarget "YogaKitSampleTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 638A94571E215CC800A726AD /* Debug */, - 638A94581E215CC800A726AD /* Release */, + 151960F724E530E700F7BF06 /* Debug */, + 151960F824E530E700F7BF06 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/YogaKit/YogaKitSample/YogaKitSampleTests/dummy.swift b/YogaKit/YogaKitSample/YogaKitSampleTests/dummy.swift new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitSampleTests/dummy.swift @@ -0,0 +1 @@ + -- 2.50.1.windows.1 From 1cef5287afc092f248b554fb56c9a3e35c5c9fe2 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 17:45:23 +0800 Subject: [PATCH 06/38] [YogaKit] remove + (void)initialize for YGLayout. --- YogaKit/Source/YGLayout.m | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 36c22d37..c7e324d2 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -156,7 +156,27 @@ YGValue YGPercentValue(CGFloat value) { return (YGValue){.value = value, .unit = YGUnitPercent}; } -static YGConfigRef globalConfig; +static CGFloat YGScaleFactor() { + static CGFloat scale; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^() { + scale = [UIScreen mainScreen].scale; + }); + + return scale; +} + +static YGConfigRef YGGlobalConfig() { + static YGConfigRef globalConfig; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^() { + globalConfig = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(globalConfig, YGExperimentalFeatureWebFlexBasis, true); + YGConfigSetPointScaleFactor(globalConfig, YGScaleFactor()); + }); + + return globalConfig; +} @interface YGLayout () @@ -172,17 +192,10 @@ static YGConfigRef globalConfig; @synthesize isIncludedInLayout = _isIncludedInLayout; @synthesize node = _node; -+ (void)initialize { - globalConfig = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled( - globalConfig, YGExperimentalFeatureWebFlexBasis, true); - YGConfigSetPointScaleFactor(globalConfig, [UIScreen mainScreen].scale); -} - - (instancetype)initWithView:(UIView*)view { if (self = [super init]) { _view = view; - _node = YGNodeNewWithConfig(globalConfig); + _node = YGNodeNewWithConfig(YGGlobalConfig()); YGNodeSetContext(_node, (__bridge void*)view); _isEnabled = NO; _isIncludedInLayout = YES; @@ -462,11 +475,7 @@ static void YGRemoveAllChildren(const YGNodeRef node) { } static CGFloat YGRoundPixelValue(CGFloat value) { - static CGFloat scale; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^() { - scale = [UIScreen mainScreen].scale; - }); + CGFloat scale = YGScaleFactor(); return ceil(value * scale) / scale; // Pixel-align } -- 2.50.1.windows.1 From a902445203a5d99fa360792cba8c53e05d7c8393 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 18:18:09 +0800 Subject: [PATCH 07/38] =?UTF-8?q?[YogaKit]=20pixel-align=20view=E2=80=99s?= =?UTF-8?q?=20frame.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YogaKit/Source/YGLayout.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index c7e324d2..fad988d5 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -527,14 +527,14 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { }, .size = { - .width = MAX(YGRoundPixelValue(bottomRight.x - topLeft.x), 0), - .height = MAX(YGRoundPixelValue(bottomRight.y - topLeft.y), 0), + .width = MAX(bottomRight.x - topLeft.x, 0), + .height = MAX(bottomRight.y - topLeft.y, 0), }, }; view.bounds = (CGRect) { .origin = view.bounds.origin, - .size = frame.size + .size = CGSizeMake(YGRoundPixelValue(CGRectGetWidth(frame)), YGRoundPixelValue(CGRectGetHeight(frame))) }; view.center = (CGPoint) { -- 2.50.1.windows.1 From 0d339b67542b0e26026d8abda487cc18e983360b Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 20:44:27 +0800 Subject: [PATCH 08/38] [YogaKit] support tvOS - add YogaKitTVSample target --- Yoga.podspec | 2 +- YogaKit.podspec | 4 +- YogaKit/YogaKitSample/Podfile | 20 +- YogaKit/YogaKitSample/Podfile.lock | 8 +- .../YogaKitSample.xcodeproj/project.pbxproj | 240 ++++++++++++++++-- .../YogaKitTVSample/AppDelegate.h | 17 ++ .../YogaKitTVSample/AppDelegate.m | 45 ++++ .../Content.imageset/Contents.json | 11 + .../Back.imagestacklayer/Contents.json | 6 + .../Contents.json | 17 ++ .../Content.imageset/Contents.json | 11 + .../Front.imagestacklayer/Contents.json | 6 + .../Content.imageset/Contents.json | 11 + .../Middle.imagestacklayer/Contents.json | 6 + .../Content.imageset/Contents.json | 16 ++ .../Back.imagestacklayer/Contents.json | 6 + .../App Icon.imagestack/Contents.json | 17 ++ .../Content.imageset/Contents.json | 16 ++ .../Front.imagestacklayer/Contents.json | 6 + .../Content.imageset/Contents.json | 16 ++ .../Middle.imagestacklayer/Contents.json | 6 + .../Contents.json | 32 +++ .../Contents.json | 24 ++ .../Top Shelf Image.imageset/Contents.json | 24 ++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 24 ++ .../Base.lproj/Main.storyboard | 28 ++ .../YogaKitSample/YogaKitTVSample/Info.plist | 34 +++ .../YogaKitTVSample/ViewController.h | 15 ++ .../YogaKitTVSample/ViewController.m | 64 +++++ .../YogaKitSample/YogaKitTVSample/dummy.swift | 1 + YogaKit/YogaKitSample/YogaKitTVSample/main.m | 19 ++ 32 files changed, 724 insertions(+), 34 deletions(-) create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/AppDelegate.h create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/AppDelegate.m create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Base.lproj/LaunchScreen.storyboard create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Base.lproj/Main.storyboard create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/Info.plist create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/ViewController.h create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/ViewController.m create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/dummy.swift create mode 100644 YogaKit/YogaKitSample/YogaKitTVSample/main.m diff --git a/Yoga.podspec b/Yoga.podspec index 76244f65..2feb55ec 100644 --- a/Yoga.podspec +++ b/Yoga.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |spec| :git => 'https://github.com/facebook/yoga.git', :tag => spec.version.to_s, } - spec.platforms = { :ios => "8.0", :osx => "10.7", :tvos => "10.0", :watchos => "2.0" } + spec.platforms = { :ios => "8.0", :osx => "10.7", :tvos => "9.0", :watchos => "2.0" } spec.module_name = 'yoga' spec.requires_arc = false spec.pod_target_xcconfig = { diff --git a/YogaKit.podspec b/YogaKit.podspec index 7ee2569b..43dd3c01 100644 --- a/YogaKit.podspec +++ b/YogaKit.podspec @@ -19,9 +19,7 @@ podspec = Pod::Spec.new do |spec| :tag => "1.18.0", } - spec.platform = :ios - spec.ios.deployment_target = '8.0' - spec.ios.frameworks = 'UIKit' + spec.platforms = { :ios => "8.0", :tvos => "9.0" } spec.module_name = 'YogaKit' spec.dependency 'Yoga', '~> 1.14.1' # Fixes the bug related the xcode 11 not able to find swift related frameworks. diff --git a/YogaKit/YogaKitSample/Podfile b/YogaKit/YogaKitSample/Podfile index c399a1d8..5da19a24 100644 --- a/YogaKit/YogaKitSample/Podfile +++ b/YogaKit/YogaKitSample/Podfile @@ -1,11 +1,21 @@ -platform :ios, '9.0' + use_frameworks! -targetsArray = ['YogaKitSample', 'YogaKitSampleTests'] -targetsArray.each do |t| - target t do +target 'YogaKitSample' do + platform :ios, '9.0' pod 'Yoga', :path => '../../Yoga.podspec' pod 'YogaKit', :path => '../../YogaKit.podspec' pod 'IGListKit', '~> 4.0.0' - end end + +target 'YogaKitSampleTests' do + platform :ios, '9.0' + pod 'Yoga', :path => '../../Yoga.podspec' + pod 'YogaKit', :path => '../../YogaKit.podspec' +end + +target 'YogaKitTVSample' do + platform :tvos, '9.0' + pod 'Yoga', :path => '../../Yoga.podspec' + pod 'YogaKit', :path => '../../YogaKit.podspec' +end \ No newline at end of file diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index fe638ba8..dd3cbc0f 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -25,9 +25,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: IGListDiffKit: 665d6cf43ce726e676013db9c7d6c4294259b6b2 IGListKit: fd5a5d21935298f5849fa49d426843cff97b77c7 - Yoga: 1b62f19e549f5e174fc935ba76a47a8d9b60211e - YogaKit: fa5270a9482b444b2f42e2ab92fdbd03854a97f3 + Yoga: d3d19e78d35f47f72da4bb51b1362311a3ab2a7c + YogaKit: 9876eab67794362a58e64dc9e7e24adadd374e75 -PODFILE CHECKSUM: 88aca7a173462716bce24678d37a225fcff1c193 +PODFILE CHECKSUM: 47eeddfbd971090a3aa5e26f13d982c79f3daf34 -COCOAPODS: 1.9.1 +COCOAPODS: 1.9.3 diff --git a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj index 9fd0cf31..383880d8 100644 --- a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj @@ -13,12 +13,21 @@ 151960FA24E5314C00F7BF06 /* YogaKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 151960F924E5314C00F7BF06 /* YogaKitTests.m */; }; 151960FC24E532B700F7BF06 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 151960FB24E532B700F7BF06 /* dummy.swift */; }; 15A7CB5995C9DAB1C8803834 /* Pods_YogaKitSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */; }; + 15E1C33C24E568410086A4E6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C33B24E568410086A4E6 /* AppDelegate.m */; }; + 15E1C33F24E568410086A4E6 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C33E24E568410086A4E6 /* ViewController.m */; }; + 15E1C34224E568410086A4E6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 15E1C34024E568410086A4E6 /* Main.storyboard */; }; + 15E1C34424E568420086A4E6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 15E1C34324E568420086A4E6 /* Assets.xcassets */; }; + 15E1C34724E568420086A4E6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 15E1C34524E568420086A4E6 /* LaunchScreen.storyboard */; }; + 15E1C34A24E568420086A4E6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C34924E568420086A4E6 /* main.m */; }; + 15E1C34F24E56A8A0086A4E6 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C34E24E56A8A0086A4E6 /* dummy.swift */; }; + 15E1C35124E56AB60086A4E6 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 15E1C35024E56AB60086A4E6 /* libc++.tbd */; }; 1D885DC3D17809A4C3E245F3 /* Pods_YogaKitSampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB0C63590A97352D30E310E /* Pods_YogaKitSampleTests.framework */; }; 40BD9F461E477A09002790A9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F451E477A09002790A9 /* AppDelegate.swift */; }; 40BD9F4B1E47850C002790A9 /* BasicViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F4A1E47850C002790A9 /* BasicViewController.swift */; }; 40BD9F501E479079002790A9 /* SingleLabelCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F4F1E479079002790A9 /* SingleLabelCollectionCell.swift */; }; 40BD9F521E479173002790A9 /* LayoutInclusionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F511E479173002790A9 /* LayoutInclusionViewController.swift */; }; 638A94481E1F06D100A726AD /* ExamplesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638A94471E1F06D100A726AD /* ExamplesViewController.swift */; }; + FF76EAD6A7089159C35EED45 /* Pods_YogaKitTVSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8925233409AB43504C102C31 /* Pods_YogaKitTVSample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -63,14 +72,29 @@ 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 151960F924E5314C00F7BF06 /* YogaKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = YogaKitTests.m; path = ../../Tests/YogaKitTests.m; sourceTree = ""; }; 151960FB24E532B700F7BF06 /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = ""; }; + 15E1C33824E568410086A4E6 /* YogaKitTVSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YogaKitTVSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 15E1C33A24E568410086A4E6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 15E1C33B24E568410086A4E6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 15E1C33D24E568410086A4E6 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 15E1C33E24E568410086A4E6 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 15E1C34124E568410086A4E6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 15E1C34324E568420086A4E6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 15E1C34624E568420086A4E6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 15E1C34824E568420086A4E6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 15E1C34924E568420086A4E6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 15E1C34E24E56A8A0086A4E6 /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = ""; }; + 15E1C35024E56AB60086A4E6 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS13.4.sdk/usr/lib/libc++.tbd"; sourceTree = DEVELOPER_DIR; }; 1D2FF4D5FCA6A8C54A4074A3 /* Pods-YogaKitSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample.debug.xcconfig"; sourceTree = ""; }; 40BD9F451E477A09002790A9 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40BD9F4A1E47850C002790A9 /* BasicViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BasicViewController.swift; path = ViewControllers/BasicViewController.swift; sourceTree = ""; }; 40BD9F4F1E479079002790A9 /* SingleLabelCollectionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SingleLabelCollectionCell.swift; path = Views/SingleLabelCollectionCell.swift; sourceTree = ""; }; 40BD9F511E479173002790A9 /* LayoutInclusionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LayoutInclusionViewController.swift; path = ViewControllers/LayoutInclusionViewController.swift; sourceTree = ""; }; 4BB0C63590A97352D30E310E /* Pods_YogaKitSampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitSampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 51E1DF9045F526AA9E84841F /* Pods-YogaKitTVSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitTVSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitTVSample/Pods-YogaKitTVSample.release.xcconfig"; sourceTree = ""; }; + 5D4F0C780E18ECECE25B2319 /* Pods-YogaKitTVSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitTVSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitTVSample/Pods-YogaKitTVSample.debug.xcconfig"; sourceTree = ""; }; 638A94471E1F06D100A726AD /* ExamplesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExamplesViewController.swift; sourceTree = ""; }; 82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample.release.xcconfig"; sourceTree = ""; }; + 8925233409AB43504C102C31 /* Pods_YogaKitTVSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitTVSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A26128CF4F9CAE93983FF74F /* Pods-YogaKitSampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests.debug.xcconfig"; sourceTree = ""; }; C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FF607399A6E2DE06593D1FA8 /* Pods-YogaKitSampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests.release.xcconfig"; sourceTree = ""; }; @@ -95,6 +119,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15E1C33524E568410086A4E6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 15E1C35124E56AB60086A4E6 /* libc++.tbd in Frameworks */, + FF76EAD6A7089159C35EED45 /* Pods_YogaKitTVSample.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -103,6 +136,7 @@ children = ( 13687D451DF8748400E7C260 /* YogaKitSample */, 151960F024E530E700F7BF06 /* YogaKitSampleTests */, + 15E1C33924E568410086A4E6 /* YogaKitTVSample */, 13687D441DF8748400E7C260 /* Products */, 13687D831DF87D1E00E7C260 /* Frameworks */, E1C759E3C8E84821213ECE8D /* Pods */, @@ -114,6 +148,7 @@ children = ( 13687D431DF8748400E7C260 /* YogaKitSample.app */, 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */, + 15E1C33824E568410086A4E6 /* YogaKitTVSample.app */, ); name = Products; sourceTree = ""; @@ -134,10 +169,12 @@ 13687D831DF87D1E00E7C260 /* Frameworks */ = { isa = PBXGroup; children = ( + 15E1C35024E56AB60086A4E6 /* libc++.tbd */, 13687D861DF87D2400E7C260 /* Foundation.framework */, 13687D841DF87D1E00E7C260 /* UIKit.framework */, C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */, 4BB0C63590A97352D30E310E /* Pods_YogaKitSampleTests.framework */, + 8925233409AB43504C102C31 /* Pods_YogaKitTVSample.framework */, ); name = Frameworks; sourceTree = ""; @@ -151,6 +188,23 @@ path = YogaKitSampleTests; sourceTree = ""; }; + 15E1C33924E568410086A4E6 /* YogaKitTVSample */ = { + isa = PBXGroup; + children = ( + 15E1C33A24E568410086A4E6 /* AppDelegate.h */, + 15E1C33B24E568410086A4E6 /* AppDelegate.m */, + 15E1C33D24E568410086A4E6 /* ViewController.h */, + 15E1C33E24E568410086A4E6 /* ViewController.m */, + 15E1C34024E568410086A4E6 /* Main.storyboard */, + 15E1C34324E568420086A4E6 /* Assets.xcassets */, + 15E1C34524E568420086A4E6 /* LaunchScreen.storyboard */, + 15E1C34824E568420086A4E6 /* Info.plist */, + 15E1C34924E568420086A4E6 /* main.m */, + 15E1C34E24E56A8A0086A4E6 /* dummy.swift */, + ); + path = YogaKitTVSample; + sourceTree = ""; + }; 40BD9F481E4784B3002790A9 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -175,6 +229,8 @@ 82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */, A26128CF4F9CAE93983FF74F /* Pods-YogaKitSampleTests.debug.xcconfig */, FF607399A6E2DE06593D1FA8 /* Pods-YogaKitSampleTests.release.xcconfig */, + 5D4F0C780E18ECECE25B2319 /* Pods-YogaKitTVSample.debug.xcconfig */, + 51E1DF9045F526AA9E84841F /* Pods-YogaKitTVSample.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -211,7 +267,6 @@ 151960EB24E530E700F7BF06 /* Sources */, 151960EC24E530E700F7BF06 /* Frameworks */, 151960ED24E530E700F7BF06 /* Resources */, - 1883DD5DF55125032E2DEF71 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -223,6 +278,24 @@ productReference = 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 15E1C33724E568410086A4E6 /* YogaKitTVSample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 15E1C34D24E568420086A4E6 /* Build configuration list for PBXNativeTarget "YogaKitTVSample" */; + buildPhases = ( + EEAEE027484A739D2AFF1F33 /* [CP] Check Pods Manifest.lock */, + 15E1C33424E568410086A4E6 /* Sources */, + 15E1C33524E568410086A4E6 /* Frameworks */, + 15E1C33624E568410086A4E6 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = YogaKitTVSample; + productName = YogaKitTVSample; + productReference = 15E1C33824E568410086A4E6 /* YogaKitTVSample.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -243,6 +316,11 @@ ProvisioningStyle = Automatic; TestTargetID = 13687D421DF8748300E7C260; }; + 15E1C33724E568410086A4E6 = { + CreatedOnToolsVersion = 11.6; + LastSwiftMigration = 1160; + ProvisioningStyle = Automatic; + }; }; }; buildConfigurationList = 13687D3E1DF8748300E7C260 /* Build configuration list for PBXProject "YogaKitSample" */; @@ -261,6 +339,7 @@ targets = ( 13687D421DF8748300E7C260 /* YogaKitSample */, 151960EE24E530E700F7BF06 /* YogaKitSampleTests */, + 15E1C33724E568410086A4E6 /* YogaKitTVSample */, ); }; /* End PBXProject section */ @@ -281,29 +360,19 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15E1C33624E568410086A4E6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 15E1C34724E568420086A4E6 /* LaunchScreen.storyboard in Resources */, + 15E1C34424E568420086A4E6 /* Assets.xcassets in Resources */, + 15E1C34224E568410086A4E6 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1883DD5DF55125032E2DEF71 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/IGListDiffKit/IGListDiffKit.framework", - "${BUILT_PRODUCTS_DIR}/IGListKit/IGListKit.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IGListDiffKit.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IGListKit.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 513B543F92B2E4F4D1EE1CE7 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -344,6 +413,28 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + EEAEE027484A739D2AFF1F33 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-YogaKitTVSample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; FA2FB9DD6471BDD3FBCE503B /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -388,6 +479,17 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15E1C33424E568410086A4E6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 15E1C33F24E568410086A4E6 /* ViewController.m in Sources */, + 15E1C34A24E568420086A4E6 /* main.m in Sources */, + 15E1C34F24E56A8A0086A4E6 /* dummy.swift in Sources */, + 15E1C33C24E568410086A4E6 /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -398,6 +500,25 @@ }; /* End PBXTargetDependency section */ +/* Begin PBXVariantGroup section */ + 15E1C34024E568410086A4E6 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 15E1C34124E568410086A4E6 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 15E1C34524E568420086A4E6 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 15E1C34624E568420086A4E6 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 13687D581DF8748400E7C260 /* Debug */ = { isa = XCBuildConfiguration; @@ -496,6 +617,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = YogaKitSample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -512,6 +634,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = YogaKitSample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -584,6 +707,72 @@ }; name = Release; }; + 15E1C34B24E568420086A4E6 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5D4F0C780E18ECECE25B2319 /* Pods-YogaKitTVSample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = YogaKitTVSample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitTVSample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + 15E1C34C24E568420086A4E6 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 51E1DF9045F526AA9E84841F /* Pods-YogaKitTVSample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = YogaKitTVSample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitTVSample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -614,6 +803,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 15E1C34D24E568420086A4E6 /* Build configuration list for PBXNativeTarget "YogaKitTVSample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15E1C34B24E568420086A4E6 /* Debug */, + 15E1C34C24E568420086A4E6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 13687D3B1DF8748300E7C260 /* Project object */; diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/AppDelegate.h b/YogaKit/YogaKitSample/YogaKitTVSample/AppDelegate.h new file mode 100644 index 00000000..b933a6ed --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// YogaKitTVSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/AppDelegate.m b/YogaKit/YogaKitSample/YogaKitTVSample/AppDelegate.m new file mode 100644 index 00000000..04938d79 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/AppDelegate.m @@ -0,0 +1,45 @@ +// +// AppDelegate.m +// YogaKitTVSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + + +@end diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000..2e003356 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json new file mode 100644 index 00000000..de59d885 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000..2e003356 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000..2e003356 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000..795cce17 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json new file mode 100644 index 00000000..de59d885 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000..795cce17 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000..795cce17 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json new file mode 100644 index 00000000..f47ba43d --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "App Icon - App Store.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "App Icon.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "Top Shelf Image Wide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + }, + { + "filename" : "Top Shelf Image.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json new file mode 100644 index 00000000..b65f0cdd --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + }, + { + "idiom" : "tv-marketing", + "scale" : "1x" + }, + { + "idiom" : "tv-marketing", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json new file mode 100644 index 00000000..b65f0cdd --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + }, + { + "idiom" : "tv-marketing", + "scale" : "1x" + }, + { + "idiom" : "tv-marketing", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/Contents.json b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Base.lproj/LaunchScreen.storyboard b/YogaKit/YogaKitSample/YogaKitTVSample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..660ba53d --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Base.lproj/Main.storyboard b/YogaKit/YogaKitSample/YogaKitTVSample/Base.lproj/Main.storyboard new file mode 100644 index 00000000..a5c40f19 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Base.lproj/Main.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/Info.plist b/YogaKit/YogaKitSample/YogaKitTVSample/Info.plist new file mode 100644 index 00000000..25869efc --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + arm64 + + UIUserInterfaceStyle + Automatic + + diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.h b/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.h new file mode 100644 index 00000000..beebe657 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// YogaKitTVSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.m b/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.m new file mode 100644 index 00000000..949fb7dc --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.m @@ -0,0 +1,64 @@ +// +// ViewController.m +// YogaKitTVSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import "ViewController.h" +@import YogaKit; + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + CGSize containerSize = self.view.bounds.size; + + UIView *root = self.view; + root.backgroundColor = UIColor.whiteColor; + [root configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { + layout.isEnabled = YES; + layout.width = YGPointValue(containerSize.width); + layout.height = YGPointValue(containerSize.height); + layout.alignItems = YGAlignCenter; + layout.justifyContent = YGJustifyCenter; + }]; + + UIView *child1 = [[UIView alloc] init]; + child1.backgroundColor = UIColor.blueColor; + [child1 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { + layout.isEnabled = YES; + layout.width = YGPointValue(100); + layout.height = YGPointValue(10); + layout.marginBottom = YGPointValue(25); + }]; + [root addSubview:child1]; + + UIView *child2 = [[UIView alloc] init]; + child2.backgroundColor = UIColor.greenColor; + [child2 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { + layout.isEnabled = YES; + layout.alignSelf = YGAlignFlexEnd; + layout.width = YGPointValue(200); + layout.height = YGPointValue(200); + }]; + [root addSubview:child2]; + + UIView *child3 = [[UIView alloc] init]; + child3.backgroundColor = UIColor.yellowColor; + [child3 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { + layout.isEnabled = YES; + layout.alignSelf = YGAlignFlexStart; + layout.width = YGPointValue(100); + layout.height = YGPointValue(100); + }]; + [root addSubview:child3]; +} + +@end diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/dummy.swift b/YogaKit/YogaKitSample/YogaKitTVSample/dummy.swift new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/dummy.swift @@ -0,0 +1 @@ + diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/main.m b/YogaKit/YogaKitSample/YogaKitTVSample/main.m new file mode 100644 index 00000000..fd154fab --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitTVSample/main.m @@ -0,0 +1,19 @@ +// +// main.m +// YogaKitTVSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + NSString * appDelegateClassName; + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + appDelegateClassName = NSStringFromClass([AppDelegate class]); + } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); +} -- 2.50.1.windows.1 From 8608c9281641a9bc02eedd21f91b38605ba9852b Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 21:44:57 +0800 Subject: [PATCH 09/38] [YogaKit] support macOS. --- YogaKit.podspec | 2 +- YogaKit/Source/UIView+Yoga.h | 1 - YogaKit/Source/UIView+Yoga.m | 70 +- YogaKit/Source/YGLayout.h | 7 + YogaKit/Source/YGLayout.m | 28 + YogaKit/YogaKitSample/Podfile | 6 + YogaKit/YogaKitSample/Podfile.lock | 4 +- .../YogaKitOSXSample/AppDelegate.h | 15 + .../YogaKitOSXSample/AppDelegate.m | 27 + .../AppIcon.appiconset/Contents.json | 58 ++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/Main.storyboard | 717 ++++++++++++++++++ .../YogaKitSample/YogaKitOSXSample/Info.plist | 36 + .../YogaKitOSXSample/ViewController.h | 15 + .../YogaKitOSXSample/ViewController.m | 68 ++ .../YogaKitOSXSample.entitlements | 10 + .../YogaKitOSXSample/dummy.swift | 1 + YogaKit/YogaKitSample/YogaKitOSXSample/main.m | 16 + .../YogaKitSample.xcodeproj/project.pbxproj | 217 ++++++ .../ViewControllers/BasicViewController.swift | 3 - .../YogaKitSample/YogaKitSample.entitlements | 10 + .../YogaKitTVSample/ViewController.m | 4 - 22 files changed, 1289 insertions(+), 32 deletions(-) create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/AppDelegate.h create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/AppDelegate.m create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/Assets.xcassets/Contents.json create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/Base.lproj/Main.storyboard create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/Info.plist create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/ViewController.h create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/ViewController.m create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/YogaKitOSXSample.entitlements create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/dummy.swift create mode 100644 YogaKit/YogaKitSample/YogaKitOSXSample/main.m create mode 100644 YogaKit/YogaKitSample/YogaKitSample/YogaKitSample.entitlements diff --git a/YogaKit.podspec b/YogaKit.podspec index 43dd3c01..22c51232 100644 --- a/YogaKit.podspec +++ b/YogaKit.podspec @@ -19,7 +19,7 @@ podspec = Pod::Spec.new do |spec| :tag => "1.18.0", } - spec.platforms = { :ios => "8.0", :tvos => "9.0" } + spec.platforms = { :ios => "8.0", :osx => "10.9", :tvos => "9.0" } spec.module_name = 'YogaKit' spec.dependency 'Yoga', '~> 1.14.1' # Fixes the bug related the xcode 11 not able to find swift related frameworks. diff --git a/YogaKit/Source/UIView+Yoga.h b/YogaKit/Source/UIView+Yoga.h index fb730c38..94d5fa72 100644 --- a/YogaKit/Source/UIView+Yoga.h +++ b/YogaKit/Source/UIView+Yoga.h @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -#import #import "YGLayout.h" NS_ASSUME_NONNULL_BEGIN diff --git a/YogaKit/Source/UIView+Yoga.m b/YogaKit/Source/UIView+Yoga.m index e6c16352..3efd2722 100644 --- a/YogaKit/Source/UIView+Yoga.m +++ b/YogaKit/Source/UIView+Yoga.m @@ -43,48 +43,76 @@ static void YogaSwizzleInstanceMethod(Class cls, SEL originalSelector, SEL swizz @implementation UIView (YogaKitAutoApplyLayout) + (void)load { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - YogaSwizzleInstanceMethod(self, @selector(initWithFrame:), @selector(_yoga_initWithFrame:)); - YogaSwizzleInstanceMethod(self, @selector(setFrame:), @selector(_yoga_setFrame:)); - YogaSwizzleInstanceMethod(self, @selector(setBounds:), @selector(_yoga_setBounds:)); - }); + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + YogaSwizzleInstanceMethod(self, @selector(initWithFrame:), @selector(_yoga_initWithFrame:)); + YogaSwizzleInstanceMethod(self, @selector(setFrame:), @selector(_yoga_setFrame:)); + YogaSwizzleInstanceMethod(self, @selector(setBounds:), @selector(_yoga_setBounds:)); +#if TARGET_OS_OSX + YogaSwizzleInstanceMethod(self, @selector(setFrameSize:), @selector(_yoga_setFrameSize:)); + YogaSwizzleInstanceMethod(self, @selector(setBoundsSize:), @selector(_yoga_setBoundsSize:)); +#endif + }); } - (CGSize)_yoga_boundsSize { - NSValue *value = (NSValue *)objc_getAssociatedObject(self, kYGBoundsSizeAssociatedKey); + NSValue *value = (NSValue *)objc_getAssociatedObject(self, kYGBoundsSizeAssociatedKey); - return value ? value.CGSizeValue : CGSizeMake(YGUndefined, YGUndefined); + return value ? +#if TARGET_OS_OSX + value.sizeValue +#else + value.CGSizeValue +#endif + : CGSizeMake(YGUndefined, YGUndefined); } - (void)set_yoga_boundsSize:(CGSize)size { - objc_setAssociatedObject(self, - kYGBoundsSizeAssociatedKey, - [NSValue valueWithCGSize:size], - OBJC_ASSOCIATION_RETAIN_NONATOMIC); + objc_setAssociatedObject(self, + kYGBoundsSizeAssociatedKey, +#if TARGET_OS_OSX + [NSValue valueWithSize:size] +#else + [NSValue valueWithCGSize:size] +#endif + , OBJC_ASSOCIATION_RETAIN_NONATOMIC); } - (instancetype)_yoga_initWithFrame:(CGRect)frame { - id _self = [self _yoga_initWithFrame:frame]; - if (_self) { - [self _yoga_applyLayout]; - } + id _self = [self _yoga_initWithFrame:frame]; + if (_self) { + [self _yoga_applyLayout]; + } - return _self; + return _self; } - (void)_yoga_setFrame:(CGRect)frame { - [self _yoga_setFrame:frame]; + [self _yoga_setFrame:frame]; - [self _yoga_applyLayout]; + [self _yoga_applyLayout]; } - (void)_yoga_setBounds:(CGRect)bounds { - [self _yoga_setBounds:bounds]; + [self _yoga_setBounds:bounds]; - [self _yoga_applyLayout]; + [self _yoga_applyLayout]; } +#if TARGET_OS_OSX +- (void)_yoga_setFrameSize:(NSSize)newSize { + [self _yoga_setFrameSize:newSize]; + + [self _yoga_applyLayout]; +} + +- (void)_yoga_setBoundsSize:(NSSize)newSize { + [self _yoga_setBoundsSize:newSize]; + + [self _yoga_applyLayout]; +} +#endif + - (void)_yoga_applyLayout { if (self.isYogaEnabled && self.yoga.isEnabled) { CGSize size = self.bounds.size; diff --git a/YogaKit/Source/YGLayout.h b/YogaKit/Source/YGLayout.h index 5a60f95e..2e13b024 100644 --- a/YogaKit/Source/YGLayout.h +++ b/YogaKit/Source/YGLayout.h @@ -5,7 +5,14 @@ * LICENSE file in the root directory of this source tree. */ +#import +#if TARGET_OS_OSX +#import +#define UIView NSView +#else #import +#endif + #import #import #import diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index fad988d5..0402152f 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -160,7 +160,11 @@ static CGFloat YGScaleFactor() { static CGFloat scale; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^() { +#if TARGET_OS_OSX + scale = [NSScreen mainScreen].backingScaleFactor; +#else scale = [UIScreen mainScreen].scale; +#endif }); return scale; @@ -388,10 +392,18 @@ static YGSize YGMeasureView( // // See https://github.com/facebook/yoga/issues/606 for more information. if (!view.yoga.isUIView || [view.subviews count] > 0) { +#if TARGET_OS_OSX + CGSize fittingSize = view.fittingSize; + sizeThatFits = (CGSize){ + .width = MIN(constrainedWidth, fittingSize.width), + .height = MIN(constrainedHeight, fittingSize.height) + }; +#else sizeThatFits = [view sizeThatFits:(CGSize){ .width = constrainedWidth, .height = constrainedHeight, }]; +#endif } return (YGSize){ @@ -513,12 +525,17 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { topLeft.y + YGNodeLayoutGetHeight(node), }; +#if TARGET_OS_OSX + const CGPoint origin = preserveOrigin ? view.frame.origin : CGPointZero; +#else // use bounds/center and not frame if non-identity transform. const CGPoint origin = preserveOrigin ? (CGPoint) { .x = view.center.x - CGRectGetWidth(view.bounds) * 0.5, .y = view.center.y - CGRectGetHeight(view.bounds) * 0.5 } : CGPointZero; +#endif + CGRect frame = (CGRect){ .origin = { @@ -532,6 +549,16 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { }, }; +#if TARGET_OS_OSX + if (!view.superview.isFlipped && view.superview.isYogaEnabled && view.superview.yoga.isEnabled) { + frame.origin.y = YGNodeLayoutGetHeight(view.superview.yoga.node) - CGRectGetMaxY(frame); + } + + view.frame = (CGRect) { + .origin = CGPointMake(YGRoundPixelValue(frame.origin.x), YGRoundPixelValue(frame.origin.y)), + .size = CGSizeMake(YGRoundPixelValue(frame.size.width), YGRoundPixelValue(frame.size.height)) + }; +#else view.bounds = (CGRect) { .origin = view.bounds.origin, .size = CGSizeMake(YGRoundPixelValue(CGRectGetWidth(frame)), YGRoundPixelValue(CGRectGetHeight(frame))) @@ -541,6 +568,7 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { .x = YGRoundPixelValue(CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5), .y = YGRoundPixelValue(CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5) }; +#endif if (!yoga.isLeaf) { for (NSUInteger i = 0; i < view.subviews.count; i++) { diff --git a/YogaKit/YogaKitSample/Podfile b/YogaKit/YogaKitSample/Podfile index 5da19a24..86049996 100644 --- a/YogaKit/YogaKitSample/Podfile +++ b/YogaKit/YogaKitSample/Podfile @@ -18,4 +18,10 @@ target 'YogaKitTVSample' do platform :tvos, '9.0' pod 'Yoga', :path => '../../Yoga.podspec' pod 'YogaKit', :path => '../../YogaKit.podspec' +end + +target 'YogaKitOSXSample' do + platform :osx, '10.10' + pod 'Yoga', :path => '../../Yoga.podspec' + pod 'YogaKit', :path => '../../YogaKit.podspec' end \ No newline at end of file diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index dd3cbc0f..3fff787f 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -26,8 +26,8 @@ SPEC CHECKSUMS: IGListDiffKit: 665d6cf43ce726e676013db9c7d6c4294259b6b2 IGListKit: fd5a5d21935298f5849fa49d426843cff97b77c7 Yoga: d3d19e78d35f47f72da4bb51b1362311a3ab2a7c - YogaKit: 9876eab67794362a58e64dc9e7e24adadd374e75 + YogaKit: 30573590c8d1ecd5c3758efba7117ad9cb1c8508 -PODFILE CHECKSUM: 47eeddfbd971090a3aa5e26f13d982c79f3daf34 +PODFILE CHECKSUM: 74e6863ea92d9031f0d141ef224a84ab74846efa COCOAPODS: 1.9.3 diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/AppDelegate.h b/YogaKit/YogaKitSample/YogaKitOSXSample/AppDelegate.h new file mode 100644 index 00000000..510a4367 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// YogaKitOSXSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import + +@interface AppDelegate : NSObject + + +@end + diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/AppDelegate.m b/YogaKit/YogaKitSample/YogaKitOSXSample/AppDelegate.m new file mode 100644 index 00000000..432e97ca --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/AppDelegate.m @@ -0,0 +1,27 @@ +// +// AppDelegate.m +// YogaKitOSXSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +} + + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + + +@end diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/Assets.xcassets/AppIcon.appiconset/Contents.json b/YogaKit/YogaKitSample/YogaKitOSXSample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..3f00db43 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/Assets.xcassets/Contents.json b/YogaKit/YogaKitSample/YogaKitOSXSample/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/Base.lproj/Main.storyboard b/YogaKit/YogaKitSample/YogaKitOSXSample/Base.lproj/Main.storyboard new file mode 100644 index 00000000..bb2a5d88 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/Base.lproj/Main.storyboard @@ -0,0 +1,717 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/Info.plist b/YogaKit/YogaKitSample/YogaKitOSXSample/Info.plist new file mode 100644 index 00000000..78974b6a --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2020 facebook. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + NSSupportsAutomaticTermination + + NSSupportsSuddenTermination + + + diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/ViewController.h b/YogaKit/YogaKitSample/YogaKitOSXSample/ViewController.h new file mode 100644 index 00000000..1f71695e --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// YogaKitOSXSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import + +@interface ViewController : NSViewController + + +@end + diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/ViewController.m b/YogaKit/YogaKitSample/YogaKitOSXSample/ViewController.m new file mode 100644 index 00000000..3f9f685b --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/ViewController.m @@ -0,0 +1,68 @@ +// +// ViewController.m +// YogaKitOSXSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import "ViewController.h" +@import YogaKit; + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + NSView *root = self.view; + root.wantsLayer = YES; + root.layer.backgroundColor = NSColor.whiteColor.CGColor; + [root configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { + layout.isEnabled = YES; + layout.alignItems = YGAlignCenter; + layout.justifyContent = YGJustifyCenter; + }]; + + NSView *child1 = [[NSView alloc] init]; + child1.wantsLayer = YES; + child1.layer.backgroundColor = NSColor.blueColor.CGColor; + [child1 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { + layout.isEnabled = YES; + layout.width = YGPointValue(100); + layout.height = YGPointValue(10); + layout.marginBottom = YGPointValue(25); + }]; + [root addSubview:child1]; + + NSView *child2 = [[NSView alloc] init]; + child2.wantsLayer = YES; + child2.layer.backgroundColor = NSColor.greenColor.CGColor; + [child2 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { + layout.isEnabled = YES; + layout.alignSelf = YGAlignFlexEnd; + layout.width = YGPointValue(200); + layout.height = YGPointValue(200); + }]; + [root addSubview:child2]; + + NSView *child3 = [[NSView alloc] init]; + child3.wantsLayer = YES; + child3.layer.backgroundColor = NSColor.yellowColor.CGColor; + [child3 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { + layout.isEnabled = YES; + layout.alignSelf = YGAlignFlexStart; + layout.width = YGPointValue(100); + layout.height = YGPointValue(100); + }]; + [root addSubview:child3]; +} + + +- (void)setRepresentedObject:(id)representedObject { + [super setRepresentedObject:representedObject]; + + // Update the view, if already loaded. +} + + +@end diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/YogaKitOSXSample.entitlements b/YogaKit/YogaKitSample/YogaKitOSXSample/YogaKitOSXSample.entitlements new file mode 100644 index 00000000..f2ef3ae0 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/YogaKitOSXSample.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/dummy.swift b/YogaKit/YogaKitSample/YogaKitOSXSample/dummy.swift new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/dummy.swift @@ -0,0 +1 @@ + diff --git a/YogaKit/YogaKitSample/YogaKitOSXSample/main.m b/YogaKit/YogaKitSample/YogaKitOSXSample/main.m new file mode 100644 index 00000000..65e2f523 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitOSXSample/main.m @@ -0,0 +1,16 @@ +// +// main.m +// YogaKitOSXSample +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import + +int main(int argc, const char * argv[]) { + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + } + return NSApplicationMain(argc, argv); +} diff --git a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj index 383880d8..65cb68dd 100644 --- a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj @@ -12,6 +12,14 @@ 13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D861DF87D2400E7C260 /* Foundation.framework */; }; 151960FA24E5314C00F7BF06 /* YogaKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 151960F924E5314C00F7BF06 /* YogaKitTests.m */; }; 151960FC24E532B700F7BF06 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 151960FB24E532B700F7BF06 /* dummy.swift */; }; + 15865F3524E56F7800345BD7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 15865F3424E56F7800345BD7 /* AppDelegate.m */; }; + 15865F3824E56F7800345BD7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15865F3724E56F7800345BD7 /* ViewController.m */; }; + 15865F3A24E56F7800345BD7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 15865F3924E56F7800345BD7 /* Assets.xcassets */; }; + 15865F3D24E56F7800345BD7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 15865F3B24E56F7800345BD7 /* Main.storyboard */; }; + 15865F4024E56F7800345BD7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 15865F3F24E56F7800345BD7 /* main.m */; }; + 15865F4624E5747800345BD7 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 15865F4524E5747800345BD7 /* libc++.tbd */; }; + 15865F4824E5748900345BD7 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15865F4724E5748900345BD7 /* dummy.swift */; }; + 1593D6D3BEDCC3E520D136F4 /* Pods_YogaKitOSXSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C318BAE128876A3592EA4EE7 /* Pods_YogaKitOSXSample.framework */; }; 15A7CB5995C9DAB1C8803834 /* Pods_YogaKitSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */; }; 15E1C33C24E568410086A4E6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C33B24E568410086A4E6 /* AppDelegate.m */; }; 15E1C33F24E568410086A4E6 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C33E24E568410086A4E6 /* ViewController.m */; }; @@ -64,6 +72,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 130B3C3D7B95A7F1337972B2 /* Pods-YogaKitOSXSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitOSXSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitOSXSample/Pods-YogaKitOSXSample.release.xcconfig"; sourceTree = ""; }; 13687D431DF8748400E7C260 /* YogaKitSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YogaKitSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13687D521DF8748400E7C260 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 13687D571DF8748400E7C260 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -72,6 +81,19 @@ 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 151960F924E5314C00F7BF06 /* YogaKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = YogaKitTests.m; path = ../../Tests/YogaKitTests.m; sourceTree = ""; }; 151960FB24E532B700F7BF06 /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = ""; }; + 15865F3124E56F7800345BD7 /* YogaKitOSXSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YogaKitOSXSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 15865F3324E56F7800345BD7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 15865F3424E56F7800345BD7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 15865F3624E56F7800345BD7 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 15865F3724E56F7800345BD7 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 15865F3924E56F7800345BD7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 15865F3C24E56F7800345BD7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 15865F3E24E56F7800345BD7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 15865F3F24E56F7800345BD7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 15865F4124E56F7800345BD7 /* YogaKitOSXSample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = YogaKitOSXSample.entitlements; sourceTree = ""; }; + 15865F4524E5747800345BD7 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/libc++.tbd"; sourceTree = DEVELOPER_DIR; }; + 15865F4724E5748900345BD7 /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = ""; }; + 15865F4924E577BE00345BD7 /* YogaKitSample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = YogaKitSample.entitlements; sourceTree = ""; }; 15E1C33824E568410086A4E6 /* YogaKitTVSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YogaKitTVSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 15E1C33A24E568410086A4E6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 15E1C33B24E568410086A4E6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -93,9 +115,11 @@ 51E1DF9045F526AA9E84841F /* Pods-YogaKitTVSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitTVSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitTVSample/Pods-YogaKitTVSample.release.xcconfig"; sourceTree = ""; }; 5D4F0C780E18ECECE25B2319 /* Pods-YogaKitTVSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitTVSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitTVSample/Pods-YogaKitTVSample.debug.xcconfig"; sourceTree = ""; }; 638A94471E1F06D100A726AD /* ExamplesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExamplesViewController.swift; sourceTree = ""; }; + 6D7F92331FB484D6ED42C5E9 /* Pods-YogaKitOSXSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitOSXSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitOSXSample/Pods-YogaKitOSXSample.debug.xcconfig"; sourceTree = ""; }; 82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample.release.xcconfig"; sourceTree = ""; }; 8925233409AB43504C102C31 /* Pods_YogaKitTVSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitTVSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A26128CF4F9CAE93983FF74F /* Pods-YogaKitSampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests.debug.xcconfig"; sourceTree = ""; }; + C318BAE128876A3592EA4EE7 /* Pods_YogaKitOSXSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitOSXSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FF607399A6E2DE06593D1FA8 /* Pods-YogaKitSampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSampleTests/Pods-YogaKitSampleTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -119,6 +143,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15865F2E24E56F7800345BD7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 15865F4624E5747800345BD7 /* libc++.tbd in Frameworks */, + 1593D6D3BEDCC3E520D136F4 /* Pods_YogaKitOSXSample.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 15E1C33524E568410086A4E6 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -137,6 +170,7 @@ 13687D451DF8748400E7C260 /* YogaKitSample */, 151960F024E530E700F7BF06 /* YogaKitSampleTests */, 15E1C33924E568410086A4E6 /* YogaKitTVSample */, + 15865F3224E56F7800345BD7 /* YogaKitOSXSample */, 13687D441DF8748400E7C260 /* Products */, 13687D831DF87D1E00E7C260 /* Frameworks */, E1C759E3C8E84821213ECE8D /* Pods */, @@ -149,6 +183,7 @@ 13687D431DF8748400E7C260 /* YogaKitSample.app */, 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */, 15E1C33824E568410086A4E6 /* YogaKitTVSample.app */, + 15865F3124E56F7800345BD7 /* YogaKitOSXSample.app */, ); name = Products; sourceTree = ""; @@ -156,6 +191,7 @@ 13687D451DF8748400E7C260 /* YogaKitSample */ = { isa = PBXGroup; children = ( + 15865F4924E577BE00345BD7 /* YogaKitSample.entitlements */, 40BD9F4E1E47902F002790A9 /* Views */, 40BD9F481E4784B3002790A9 /* ViewControllers */, 638A94471E1F06D100A726AD /* ExamplesViewController.swift */, @@ -170,11 +206,13 @@ isa = PBXGroup; children = ( 15E1C35024E56AB60086A4E6 /* libc++.tbd */, + 15865F4524E5747800345BD7 /* libc++.tbd */, 13687D861DF87D2400E7C260 /* Foundation.framework */, 13687D841DF87D1E00E7C260 /* UIKit.framework */, C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */, 4BB0C63590A97352D30E310E /* Pods_YogaKitSampleTests.framework */, 8925233409AB43504C102C31 /* Pods_YogaKitTVSample.framework */, + C318BAE128876A3592EA4EE7 /* Pods_YogaKitOSXSample.framework */, ); name = Frameworks; sourceTree = ""; @@ -188,6 +226,23 @@ path = YogaKitSampleTests; sourceTree = ""; }; + 15865F3224E56F7800345BD7 /* YogaKitOSXSample */ = { + isa = PBXGroup; + children = ( + 15865F3324E56F7800345BD7 /* AppDelegate.h */, + 15865F3424E56F7800345BD7 /* AppDelegate.m */, + 15865F3624E56F7800345BD7 /* ViewController.h */, + 15865F3724E56F7800345BD7 /* ViewController.m */, + 15865F3924E56F7800345BD7 /* Assets.xcassets */, + 15865F3B24E56F7800345BD7 /* Main.storyboard */, + 15865F3E24E56F7800345BD7 /* Info.plist */, + 15865F3F24E56F7800345BD7 /* main.m */, + 15865F4724E5748900345BD7 /* dummy.swift */, + 15865F4124E56F7800345BD7 /* YogaKitOSXSample.entitlements */, + ); + path = YogaKitOSXSample; + sourceTree = ""; + }; 15E1C33924E568410086A4E6 /* YogaKitTVSample */ = { isa = PBXGroup; children = ( @@ -231,6 +286,8 @@ FF607399A6E2DE06593D1FA8 /* Pods-YogaKitSampleTests.release.xcconfig */, 5D4F0C780E18ECECE25B2319 /* Pods-YogaKitTVSample.debug.xcconfig */, 51E1DF9045F526AA9E84841F /* Pods-YogaKitTVSample.release.xcconfig */, + 6D7F92331FB484D6ED42C5E9 /* Pods-YogaKitOSXSample.debug.xcconfig */, + 130B3C3D7B95A7F1337972B2 /* Pods-YogaKitOSXSample.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -278,6 +335,24 @@ productReference = 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 15865F3024E56F7800345BD7 /* YogaKitOSXSample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 15865F4424E56F7800345BD7 /* Build configuration list for PBXNativeTarget "YogaKitOSXSample" */; + buildPhases = ( + 48411F57309F483CDA923BEA /* [CP] Check Pods Manifest.lock */, + 15865F2D24E56F7800345BD7 /* Sources */, + 15865F2E24E56F7800345BD7 /* Frameworks */, + 15865F2F24E56F7800345BD7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = YogaKitOSXSample; + productName = YogaKitOSXSample; + productReference = 15865F3124E56F7800345BD7 /* YogaKitOSXSample.app */; + productType = "com.apple.product-type.application"; + }; 15E1C33724E568410086A4E6 /* YogaKitTVSample */ = { isa = PBXNativeTarget; buildConfigurationList = 15E1C34D24E568420086A4E6 /* Build configuration list for PBXNativeTarget "YogaKitTVSample" */; @@ -307,6 +382,7 @@ TargetAttributes = { 13687D421DF8748300E7C260 = { CreatedOnToolsVersion = 8.1; + DevelopmentTeam = J29VN6AP39; LastSwiftMigration = 0820; ProvisioningStyle = Automatic; }; @@ -316,6 +392,11 @@ ProvisioningStyle = Automatic; TestTargetID = 13687D421DF8748300E7C260; }; + 15865F3024E56F7800345BD7 = { + CreatedOnToolsVersion = 11.6; + LastSwiftMigration = 1160; + ProvisioningStyle = Automatic; + }; 15E1C33724E568410086A4E6 = { CreatedOnToolsVersion = 11.6; LastSwiftMigration = 1160; @@ -340,6 +421,7 @@ 13687D421DF8748300E7C260 /* YogaKitSample */, 151960EE24E530E700F7BF06 /* YogaKitSampleTests */, 15E1C33724E568410086A4E6 /* YogaKitTVSample */, + 15865F3024E56F7800345BD7 /* YogaKitOSXSample */, ); }; /* End PBXProject section */ @@ -360,6 +442,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15865F2F24E56F7800345BD7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 15865F3A24E56F7800345BD7 /* Assets.xcassets in Resources */, + 15865F3D24E56F7800345BD7 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 15E1C33624E568410086A4E6 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -373,6 +464,28 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 48411F57309F483CDA923BEA /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-YogaKitOSXSample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 513B543F92B2E4F4D1EE1CE7 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -479,6 +592,17 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15865F2D24E56F7800345BD7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 15865F3824E56F7800345BD7 /* ViewController.m in Sources */, + 15865F4024E56F7800345BD7 /* main.m in Sources */, + 15865F4824E5748900345BD7 /* dummy.swift in Sources */, + 15865F3524E56F7800345BD7 /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 15E1C33424E568410086A4E6 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -501,6 +625,14 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ + 15865F3B24E56F7800345BD7 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 15865F3C24E56F7800345BD7 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; 15E1C34024E568410086A4E6 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( @@ -616,14 +748,18 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = YogaKitSample/YogaKitSample.entitlements; + DEVELOPMENT_TEAM = J29VN6AP39; INFOPLIST_FILE = YogaKitSample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTS_MACCATALYST = YES; SWIFT_INSTALL_OBJC_HEADER = NO; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -633,13 +769,17 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = YogaKitSample/YogaKitSample.entitlements; + DEVELOPMENT_TEAM = J29VN6AP39; INFOPLIST_FILE = YogaKitSample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTS_MACCATALYST = YES; SWIFT_INSTALL_OBJC_HEADER = NO; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; @@ -707,6 +847,74 @@ }; name = Release; }; + 15865F4224E56F7800345BD7 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6D7F92331FB484D6ED42C5E9 /* Pods-YogaKitOSXSample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = YogaKitOSXSample/YogaKitOSXSample.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = YogaKitOSXSample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitOSXSample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 15865F4324E56F7800345BD7 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 130B3C3D7B95A7F1337972B2 /* Pods-YogaKitOSXSample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = YogaKitOSXSample/YogaKitOSXSample.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = YogaKitOSXSample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitOSXSample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; 15E1C34B24E568420086A4E6 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 5D4F0C780E18ECECE25B2319 /* Pods-YogaKitTVSample.debug.xcconfig */; @@ -803,6 +1011,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 15865F4424E56F7800345BD7 /* Build configuration list for PBXNativeTarget "YogaKitOSXSample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15865F4224E56F7800345BD7 /* Debug */, + 15865F4324E56F7800345BD7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 15E1C34D24E568420086A4E6 /* Build configuration list for PBXNativeTarget "YogaKitTVSample" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/BasicViewController.swift b/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/BasicViewController.swift index 9637baef..cd170335 100644 --- a/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/BasicViewController.swift +++ b/YogaKit/YogaKitSample/YogaKitSample/ViewControllers/BasicViewController.swift @@ -10,14 +10,11 @@ import YogaKit final class BasicViewController: UIViewController { override func viewDidLoad() { - let containerSize = self.view.bounds.size let root = self.view! root.backgroundColor = .white root.configureLayout { (layout) in layout.isEnabled = true - layout.width = YGValue(containerSize.width) - layout.height = YGValue(containerSize.height) layout.alignItems = .center layout.justifyContent = .center } diff --git a/YogaKit/YogaKitSample/YogaKitSample/YogaKitSample.entitlements b/YogaKit/YogaKitSample/YogaKitSample/YogaKitSample.entitlements new file mode 100644 index 00000000..ee95ab7e --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitSample/YogaKitSample.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + diff --git a/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.m b/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.m index 949fb7dc..ec5b6382 100644 --- a/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.m +++ b/YogaKit/YogaKitSample/YogaKitTVSample/ViewController.m @@ -18,14 +18,10 @@ - (void)viewDidLoad { [super viewDidLoad]; - CGSize containerSize = self.view.bounds.size; - UIView *root = self.view; root.backgroundColor = UIColor.whiteColor; [root configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { layout.isEnabled = YES; - layout.width = YGPointValue(containerSize.width); - layout.height = YGPointValue(containerSize.height); layout.alignItems = YGAlignCenter; layout.justifyContent = YGJustifyCenter; }]; -- 2.50.1.windows.1 From d000474ba2b744a876184a31e8f1690df9c4e834 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 21:47:28 +0800 Subject: [PATCH 10/38] [YogaKit] remove DEVELOPMENT_TEAM from project. --- .../YogaKitSample.xcodeproj/project.pbxproj | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj index 65cb68dd..bf117fa3 100644 --- a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj @@ -382,7 +382,6 @@ TargetAttributes = { 13687D421DF8748300E7C260 = { CreatedOnToolsVersion = 8.1; - DevelopmentTeam = J29VN6AP39; LastSwiftMigration = 0820; ProvisioningStyle = Automatic; }; @@ -749,13 +748,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = YogaKitSample/YogaKitSample.entitlements; - DEVELOPMENT_TEAM = J29VN6AP39; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = YogaKitSample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample; PRODUCT_NAME = "$(TARGET_NAME)"; - SUPPORTS_MACCATALYST = YES; + SUPPORTS_MACCATALYST = NO; SWIFT_INSTALL_OBJC_HEADER = NO; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -770,13 +769,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = YogaKitSample/YogaKitSample.entitlements; - DEVELOPMENT_TEAM = J29VN6AP39; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = YogaKitSample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample; PRODUCT_NAME = "$(TARGET_NAME)"; - SUPPORTS_MACCATALYST = YES; + SUPPORTS_MACCATALYST = NO; SWIFT_INSTALL_OBJC_HEADER = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; -- 2.50.1.windows.1 From 890edf5af01538daad815b22d6576327e1cf1a1c Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 22:50:47 +0800 Subject: [PATCH 11/38] [YogaKit] rename module yoga to Yoga. --- Yoga.podspec | 2 +- YogaKit/Source/YGLayoutExtensions.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Yoga.podspec b/Yoga.podspec index 2feb55ec..75075fa6 100644 --- a/Yoga.podspec +++ b/Yoga.podspec @@ -19,7 +19,7 @@ Pod::Spec.new do |spec| :tag => spec.version.to_s, } spec.platforms = { :ios => "8.0", :osx => "10.7", :tvos => "9.0", :watchos => "2.0" } - spec.module_name = 'yoga' + spec.module_name = 'Yoga' spec.requires_arc = false spec.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' diff --git a/YogaKit/Source/YGLayoutExtensions.swift b/YogaKit/Source/YGLayoutExtensions.swift index 2157c0ff..5bc191aa 100644 --- a/YogaKit/Source/YGLayoutExtensions.swift +++ b/YogaKit/Source/YGLayoutExtensions.swift @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import yoga; +import Yoga postfix operator % extension Int { -- 2.50.1.windows.1 From 709cee78e7e9cd0347caeb4edf6a9e49750ee436 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 22:54:27 +0800 Subject: [PATCH 12/38] [YogaKit] update Podfile.lock of YogaKitSample --- YogaKit/YogaKitSample/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index 3fff787f..7ea86ac8 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -25,7 +25,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: IGListDiffKit: 665d6cf43ce726e676013db9c7d6c4294259b6b2 IGListKit: fd5a5d21935298f5849fa49d426843cff97b77c7 - Yoga: d3d19e78d35f47f72da4bb51b1362311a3ab2a7c + Yoga: 66186cbdf82afe25cc8c9b9adc100667063a21e8 YogaKit: 30573590c8d1ecd5c3758efba7117ad9cb1c8508 PODFILE CHECKSUM: 74e6863ea92d9031f0d141ef224a84ab74846efa -- 2.50.1.windows.1 From 4f69c9bd1d14887b60de1573aff9decc00f79e6f Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 23:17:00 +0800 Subject: [PATCH 13/38] [YogaKit] add YogaKit.xcodeproj for support Carthage --- YogaKit.xcodeproj | 1 + YogaKit/Source/YogaKit.h | 10 + YogaKit/YogaKit.xcodeproj/project.pbxproj | 701 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/xcschemes/Yoga.xcscheme | 67 ++ .../xcshareddata/xcschemes/YogaKit.xcscheme | 67 ++ 7 files changed, 861 insertions(+) create mode 120000 YogaKit.xcodeproj create mode 100644 YogaKit/Source/YogaKit.h create mode 100644 YogaKit/YogaKit.xcodeproj/project.pbxproj create mode 100644 YogaKit/YogaKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 YogaKit/YogaKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 YogaKit/YogaKit.xcodeproj/xcshareddata/xcschemes/Yoga.xcscheme create mode 100644 YogaKit/YogaKit.xcodeproj/xcshareddata/xcschemes/YogaKit.xcscheme diff --git a/YogaKit.xcodeproj b/YogaKit.xcodeproj new file mode 120000 index 00000000..c6fba3de --- /dev/null +++ b/YogaKit.xcodeproj @@ -0,0 +1 @@ +YogaKit/YogaKit.xcodeproj \ No newline at end of file diff --git a/YogaKit/Source/YogaKit.h b/YogaKit/Source/YogaKit.h new file mode 100644 index 00000000..d0b107ff --- /dev/null +++ b/YogaKit/Source/YogaKit.h @@ -0,0 +1,10 @@ +// +// YogaKit.h +// YogaKit +// +// Created by lvv on 2020/8/13. +// Copyright © 2020 facebook. All rights reserved. +// + +#import "YGLayout.h" +#import "UIView+Yoga.h" diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj new file mode 100644 index 00000000..b38bfb01 --- /dev/null +++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj @@ -0,0 +1,701 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 15865F6624E583F000345BD7 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F5F24E583F000345BD7 /* YGLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 15865F6724E583F000345BD7 /* UIView+Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6024E583F000345BD7 /* UIView+Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 15865F6824E583F000345BD7 /* YGLayout+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6124E583F000345BD7 /* YGLayout+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15865F6924E583F000345BD7 /* YGLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 15865F6224E583F000345BD7 /* YGLayout.m */; }; + 15865F6A24E583F000345BD7 /* UIView+Yoga.m in Sources */ = {isa = PBXBuildFile; fileRef = 15865F6324E583F000345BD7 /* UIView+Yoga.m */; }; + 15865F6C24E583F000345BD7 /* YogaKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6524E583F000345BD7 /* YogaKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1586600824E58C0F00345BD7 /* Yoga.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15865FFE24E58BD800345BD7 /* Yoga.framework */; }; + 1586602924E58C3700345BD7 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586600924E58C3600345BD7 /* Utils.cpp */; }; + 1586602A24E58C3700345BD7 /* experiments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586600B24E58C3600345BD7 /* experiments.cpp */; }; + 1586602B24E58C3700345BD7 /* experiments-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586600C24E58C3600345BD7 /* experiments-inl.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586602C24E58C3700345BD7 /* experiments.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586600D24E58C3600345BD7 /* experiments.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586602D24E58C3700345BD7 /* YGStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586600E24E58C3600345BD7 /* YGStyle.cpp */; }; + 1586602E24E58C3700345BD7 /* YGNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586600F24E58C3600345BD7 /* YGNode.cpp */; }; + 1586602F24E58C3700345BD7 /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601024E58C3600345BD7 /* YGConfig.cpp */; }; + 1586603024E58C3700345BD7 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601124E58C3600345BD7 /* Utils.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586603124E58C3700345BD7 /* BitUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601224E58C3600345BD7 /* BitUtils.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586603224E58C3700345BD7 /* CompactValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601324E58C3600345BD7 /* CompactValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586603324E58C3700345BD7 /* YGValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601424E58C3700345BD7 /* YGValue.cpp */; }; + 1586603424E58C3700345BD7 /* YGLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601524E58C3700345BD7 /* YGLayout.cpp */; }; + 1586603524E58C3700345BD7 /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601624E58C3700345BD7 /* log.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586603624E58C3700345BD7 /* YGNodePrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601724E58C3700345BD7 /* YGNodePrint.cpp */; }; + 1586603724E58C3700345BD7 /* event.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601924E58C3700345BD7 /* event.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586603824E58C3700345BD7 /* event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586601A24E58C3700345BD7 /* event.cpp */; }; + 1586603924E58C3700345BD7 /* YGNodePrint.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601B24E58C3700345BD7 /* YGNodePrint.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586603A24E58C3700345BD7 /* Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601C24E58C3700345BD7 /* Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1586603B24E58C3700345BD7 /* YGFloatOptional.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601D24E58C3700345BD7 /* YGFloatOptional.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586603C24E58C3700345BD7 /* YGConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601E24E58C3700345BD7 /* YGConfig.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586603D24E58C3700345BD7 /* YGMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601F24E58C3700345BD7 /* YGMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1586603E24E58C3700345BD7 /* YGEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602024E58C3700345BD7 /* YGEnums.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1586603F24E58C3700345BD7 /* log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586602124E58C3700345BD7 /* log.cpp */; }; + 1586604024E58C3700345BD7 /* YGStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602224E58C3700345BD7 /* YGStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1586604124E58C3700345BD7 /* Yoga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586602324E58C3700345BD7 /* Yoga.cpp */; }; + 1586604224E58C3700345BD7 /* Yoga-internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602424E58C3700345BD7 /* Yoga-internal.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586604324E58C3700345BD7 /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602524E58C3700345BD7 /* YGValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1586604424E58C3700345BD7 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602624E58C3700345BD7 /* YGLayout.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1586604524E58C3700345BD7 /* YGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602724E58C3700345BD7 /* YGNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1586604624E58C3700345BD7 /* YGEnums.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586602824E58C3700345BD7 /* YGEnums.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 1586600624E58C0900345BD7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15865F4B24E5834E00345BD7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 15865FFD24E58BD800345BD7; + remoteInfo = Yoga; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 15865F5424E5834E00345BD7 /* YogaKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YogaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 15865F5F24E583F000345BD7 /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = ""; }; + 15865F6024E583F000345BD7 /* UIView+Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Yoga.h"; sourceTree = ""; }; + 15865F6124E583F000345BD7 /* YGLayout+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "YGLayout+Private.h"; sourceTree = ""; }; + 15865F6224E583F000345BD7 /* YGLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YGLayout.m; sourceTree = ""; }; + 15865F6324E583F000345BD7 /* UIView+Yoga.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Yoga.m"; sourceTree = ""; }; + 15865F6524E583F000345BD7 /* YogaKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YogaKit.h; sourceTree = ""; }; + 15865FFE24E58BD800345BD7 /* Yoga.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Yoga.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1586600924E58C3600345BD7 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utils.cpp; sourceTree = ""; }; + 1586600B24E58C3600345BD7 /* experiments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = experiments.cpp; sourceTree = ""; }; + 1586600C24E58C3600345BD7 /* experiments-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "experiments-inl.h"; sourceTree = ""; }; + 1586600D24E58C3600345BD7 /* experiments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = experiments.h; sourceTree = ""; }; + 1586600E24E58C3600345BD7 /* YGStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGStyle.cpp; sourceTree = ""; }; + 1586600F24E58C3600345BD7 /* YGNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNode.cpp; sourceTree = ""; }; + 1586601024E58C3600345BD7 /* YGConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGConfig.cpp; sourceTree = ""; }; + 1586601124E58C3600345BD7 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = ""; }; + 1586601224E58C3600345BD7 /* BitUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitUtils.h; sourceTree = ""; }; + 1586601324E58C3600345BD7 /* CompactValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompactValue.h; sourceTree = ""; }; + 1586601424E58C3700345BD7 /* YGValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGValue.cpp; sourceTree = ""; }; + 1586601524E58C3700345BD7 /* YGLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGLayout.cpp; sourceTree = ""; }; + 1586601624E58C3700345BD7 /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; + 1586601724E58C3700345BD7 /* YGNodePrint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNodePrint.cpp; sourceTree = ""; }; + 1586601924E58C3700345BD7 /* event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = event.h; sourceTree = ""; }; + 1586601A24E58C3700345BD7 /* event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = event.cpp; sourceTree = ""; }; + 1586601B24E58C3700345BD7 /* YGNodePrint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNodePrint.h; sourceTree = ""; }; + 1586601C24E58C3700345BD7 /* Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Yoga.h; sourceTree = ""; }; + 1586601D24E58C3700345BD7 /* YGFloatOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGFloatOptional.h; sourceTree = ""; }; + 1586601E24E58C3700345BD7 /* YGConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGConfig.h; sourceTree = ""; }; + 1586601F24E58C3700345BD7 /* YGMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGMacros.h; sourceTree = ""; }; + 1586602024E58C3700345BD7 /* YGEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGEnums.h; sourceTree = ""; }; + 1586602124E58C3700345BD7 /* log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = log.cpp; sourceTree = ""; }; + 1586602224E58C3700345BD7 /* YGStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGStyle.h; sourceTree = ""; }; + 1586602324E58C3700345BD7 /* Yoga.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Yoga.cpp; sourceTree = ""; }; + 1586602424E58C3700345BD7 /* Yoga-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Yoga-internal.h"; sourceTree = ""; }; + 1586602524E58C3700345BD7 /* YGValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGValue.h; sourceTree = ""; }; + 1586602624E58C3700345BD7 /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = ""; }; + 1586602724E58C3700345BD7 /* YGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNode.h; sourceTree = ""; }; + 1586602824E58C3700345BD7 /* YGEnums.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGEnums.cpp; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 15865F5124E5834E00345BD7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1586600824E58C0F00345BD7 /* Yoga.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 15865FFB24E58BD800345BD7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 15865F4A24E5834E00345BD7 = { + isa = PBXGroup; + children = ( + 15865F5624E5834E00345BD7 /* YogaKit */, + 15865FFF24E58BD800345BD7 /* Yoga */, + 15865F5524E5834E00345BD7 /* Products */, + 15865FB824E584FF00345BD7 /* Frameworks */, + ); + sourceTree = ""; + }; + 15865F5524E5834E00345BD7 /* Products */ = { + isa = PBXGroup; + children = ( + 15865F5424E5834E00345BD7 /* YogaKit.framework */, + 15865FFE24E58BD800345BD7 /* Yoga.framework */, + ); + name = Products; + sourceTree = ""; + }; + 15865F5624E5834E00345BD7 /* YogaKit */ = { + isa = PBXGroup; + children = ( + 15865F6024E583F000345BD7 /* UIView+Yoga.h */, + 15865F6324E583F000345BD7 /* UIView+Yoga.m */, + 15865F5F24E583F000345BD7 /* YGLayout.h */, + 15865F6224E583F000345BD7 /* YGLayout.m */, + 15865F6124E583F000345BD7 /* YGLayout+Private.h */, + 15865F6524E583F000345BD7 /* YogaKit.h */, + ); + name = YogaKit; + path = Source; + sourceTree = ""; + }; + 15865FB824E584FF00345BD7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + 15865FFF24E58BD800345BD7 /* Yoga */ = { + isa = PBXGroup; + children = ( + 1586601224E58C3600345BD7 /* BitUtils.h */, + 1586601324E58C3600345BD7 /* CompactValue.h */, + 1586601824E58C3700345BD7 /* event */, + 1586600A24E58C3600345BD7 /* internal */, + 1586602124E58C3700345BD7 /* log.cpp */, + 1586601624E58C3700345BD7 /* log.h */, + 1586600924E58C3600345BD7 /* Utils.cpp */, + 1586601124E58C3600345BD7 /* Utils.h */, + 1586601024E58C3600345BD7 /* YGConfig.cpp */, + 1586601E24E58C3700345BD7 /* YGConfig.h */, + 1586602824E58C3700345BD7 /* YGEnums.cpp */, + 1586602024E58C3700345BD7 /* YGEnums.h */, + 1586601D24E58C3700345BD7 /* YGFloatOptional.h */, + 1586601524E58C3700345BD7 /* YGLayout.cpp */, + 1586602624E58C3700345BD7 /* YGLayout.h */, + 1586601F24E58C3700345BD7 /* YGMacros.h */, + 1586600F24E58C3600345BD7 /* YGNode.cpp */, + 1586602724E58C3700345BD7 /* YGNode.h */, + 1586601724E58C3700345BD7 /* YGNodePrint.cpp */, + 1586601B24E58C3700345BD7 /* YGNodePrint.h */, + 1586600E24E58C3600345BD7 /* YGStyle.cpp */, + 1586602224E58C3700345BD7 /* YGStyle.h */, + 1586601424E58C3700345BD7 /* YGValue.cpp */, + 1586602524E58C3700345BD7 /* YGValue.h */, + 1586602424E58C3700345BD7 /* Yoga-internal.h */, + 1586602324E58C3700345BD7 /* Yoga.cpp */, + 1586601C24E58C3700345BD7 /* Yoga.h */, + ); + name = Yoga; + path = ../yoga; + sourceTree = ""; + }; + 1586600A24E58C3600345BD7 /* internal */ = { + isa = PBXGroup; + children = ( + 1586600B24E58C3600345BD7 /* experiments.cpp */, + 1586600C24E58C3600345BD7 /* experiments-inl.h */, + 1586600D24E58C3600345BD7 /* experiments.h */, + ); + path = internal; + sourceTree = ""; + }; + 1586601824E58C3700345BD7 /* event */ = { + isa = PBXGroup; + children = ( + 1586601924E58C3700345BD7 /* event.h */, + 1586601A24E58C3700345BD7 /* event.cpp */, + ); + path = event; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 15865F4F24E5834E00345BD7 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 15865F6624E583F000345BD7 /* YGLayout.h in Headers */, + 15865F6724E583F000345BD7 /* UIView+Yoga.h in Headers */, + 15865F6C24E583F000345BD7 /* YogaKit.h in Headers */, + 15865F6824E583F000345BD7 /* YGLayout+Private.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 15865FF924E58BD800345BD7 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1586604524E58C3700345BD7 /* YGNode.h in Headers */, + 1586603E24E58C3700345BD7 /* YGEnums.h in Headers */, + 1586603A24E58C3700345BD7 /* Yoga.h in Headers */, + 1586603D24E58C3700345BD7 /* YGMacros.h in Headers */, + 1586604324E58C3700345BD7 /* YGValue.h in Headers */, + 1586604024E58C3700345BD7 /* YGStyle.h in Headers */, + 1586603124E58C3700345BD7 /* BitUtils.h in Headers */, + 1586603024E58C3700345BD7 /* Utils.h in Headers */, + 1586602B24E58C3700345BD7 /* experiments-inl.h in Headers */, + 1586603724E58C3700345BD7 /* event.h in Headers */, + 1586603524E58C3700345BD7 /* log.h in Headers */, + 1586603224E58C3700345BD7 /* CompactValue.h in Headers */, + 1586603924E58C3700345BD7 /* YGNodePrint.h in Headers */, + 1586604224E58C3700345BD7 /* Yoga-internal.h in Headers */, + 1586603C24E58C3700345BD7 /* YGConfig.h in Headers */, + 1586604424E58C3700345BD7 /* YGLayout.h in Headers */, + 1586602C24E58C3700345BD7 /* experiments.h in Headers */, + 1586603B24E58C3700345BD7 /* YGFloatOptional.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 15865F5324E5834E00345BD7 /* YogaKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 15865F5C24E5834E00345BD7 /* Build configuration list for PBXNativeTarget "YogaKit" */; + buildPhases = ( + 15865F4F24E5834E00345BD7 /* Headers */, + 15865F5024E5834E00345BD7 /* Sources */, + 15865F5124E5834E00345BD7 /* Frameworks */, + 15865F5224E5834E00345BD7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1586600724E58C0900345BD7 /* PBXTargetDependency */, + ); + name = YogaKit; + productName = YogaKit; + productReference = 15865F5424E5834E00345BD7 /* YogaKit.framework */; + productType = "com.apple.product-type.framework"; + }; + 15865FFD24E58BD800345BD7 /* Yoga */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1586600324E58BD800345BD7 /* Build configuration list for PBXNativeTarget "Yoga" */; + buildPhases = ( + 15865FF924E58BD800345BD7 /* Headers */, + 15865FFA24E58BD800345BD7 /* Sources */, + 15865FFB24E58BD800345BD7 /* Frameworks */, + 15865FFC24E58BD800345BD7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Yoga; + productName = Yoga; + productReference = 15865FFE24E58BD800345BD7 /* Yoga.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 15865F4B24E5834E00345BD7 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1160; + ORGANIZATIONNAME = facebook; + TargetAttributes = { + 15865F5324E5834E00345BD7 = { + CreatedOnToolsVersion = 11.6; + LastSwiftMigration = 1160; + }; + 15865FFD24E58BD800345BD7 = { + CreatedOnToolsVersion = 11.6; + }; + }; + }; + buildConfigurationList = 15865F4E24E5834E00345BD7 /* Build configuration list for PBXProject "YogaKit" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 15865F4A24E5834E00345BD7; + productRefGroup = 15865F5524E5834E00345BD7 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 15865F5324E5834E00345BD7 /* YogaKit */, + 15865FFD24E58BD800345BD7 /* Yoga */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 15865F5224E5834E00345BD7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 15865FFC24E58BD800345BD7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 15865F5024E5834E00345BD7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 15865F6A24E583F000345BD7 /* UIView+Yoga.m in Sources */, + 15865F6924E583F000345BD7 /* YGLayout.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 15865FFA24E58BD800345BD7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1586602A24E58C3700345BD7 /* experiments.cpp in Sources */, + 1586602F24E58C3700345BD7 /* YGConfig.cpp in Sources */, + 1586602E24E58C3700345BD7 /* YGNode.cpp in Sources */, + 1586603624E58C3700345BD7 /* YGNodePrint.cpp in Sources */, + 1586604624E58C3700345BD7 /* YGEnums.cpp in Sources */, + 1586602D24E58C3700345BD7 /* YGStyle.cpp in Sources */, + 1586604124E58C3700345BD7 /* Yoga.cpp in Sources */, + 1586602924E58C3700345BD7 /* Utils.cpp in Sources */, + 1586603424E58C3700345BD7 /* YGLayout.cpp in Sources */, + 1586603824E58C3700345BD7 /* event.cpp in Sources */, + 1586603F24E58C3700345BD7 /* log.cpp in Sources */, + 1586603324E58C3700345BD7 /* YGValue.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1586600724E58C0900345BD7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 15865FFD24E58BD800345BD7 /* Yoga */; + targetProxy = 1586600624E58C0900345BD7 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 15865F5A24E5834E00345BD7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.6; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 15865F5B24E5834E00345BD7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.6; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 15865F5D24E5834E00345BD7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + "ARCHS[sdk=appletvos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=appletvsimulator*]" = ( + i386, + x86_64, + ); + "ARCHS[sdk=iphoneos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=iphonesimulator*]" = ( + i386, + x86_64, + ); + "ARCHS[sdk=macosx*]" = ( + i386, + x86_64, + ); + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKit; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos iphoneos iphonesimulator macosx"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALID_ARCHS = "i386 x86_64 arm64 armv7"; + }; + name = Debug; + }; + 15865F5E24E5834E00345BD7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + "ARCHS[sdk=appletvos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=iphoneos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=macosx*]" = x86_64; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKit; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos iphoneos iphonesimulator macosx"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALID_ARCHS = "i386 x86_64 arm64 armv7"; + }; + name = Release; + }; + 1586600424E58BD800345BD7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + "ARCHS[sdk=appletvos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=appletvsimulator*]" = ( + i386, + x86_64, + ); + "ARCHS[sdk=iphoneos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=iphonesimulator*]" = ( + i386, + x86_64, + ); + "ARCHS[sdk=macosx*]" = x86_64; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos iphoneos iphonesimulator macosx"; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALID_ARCHS = "i386 x86_64 arm64 armv7"; + }; + name = Debug; + }; + 1586600524E58BD800345BD7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + "ARCHS[sdk=appletvos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=iphoneos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=macosx*]" = x86_64; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos iphoneos iphonesimulator macosx"; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALID_ARCHS = "i386 x86_64 arm64 armv7"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 15865F4E24E5834E00345BD7 /* Build configuration list for PBXProject "YogaKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15865F5A24E5834E00345BD7 /* Debug */, + 15865F5B24E5834E00345BD7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 15865F5C24E5834E00345BD7 /* Build configuration list for PBXNativeTarget "YogaKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15865F5D24E5834E00345BD7 /* Debug */, + 15865F5E24E5834E00345BD7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1586600324E58BD800345BD7 /* Build configuration list for PBXNativeTarget "Yoga" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1586600424E58BD800345BD7 /* Debug */, + 1586600524E58BD800345BD7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 15865F4B24E5834E00345BD7 /* Project object */; +} diff --git a/YogaKit/YogaKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/YogaKit/YogaKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..98dd3194 --- /dev/null +++ b/YogaKit/YogaKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/YogaKit/YogaKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/YogaKit/YogaKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/YogaKit/YogaKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/YogaKit/YogaKit.xcodeproj/xcshareddata/xcschemes/Yoga.xcscheme b/YogaKit/YogaKit.xcodeproj/xcshareddata/xcschemes/Yoga.xcscheme new file mode 100644 index 00000000..fa3888ce --- /dev/null +++ b/YogaKit/YogaKit.xcodeproj/xcshareddata/xcschemes/Yoga.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YogaKit/YogaKit.xcodeproj/xcshareddata/xcschemes/YogaKit.xcscheme b/YogaKit/YogaKit.xcodeproj/xcshareddata/xcschemes/YogaKit.xcscheme new file mode 100644 index 00000000..a170deef --- /dev/null +++ b/YogaKit/YogaKit.xcodeproj/xcshareddata/xcschemes/YogaKit.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.50.1.windows.1 From ed3c29c22ed8195e32a2caae9fbc487b68a02312 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Thu, 13 Aug 2020 23:46:52 +0800 Subject: [PATCH 14/38] [YogaKit] update YogaKit.xcodeproj --- YogaKit/YogaKit.xcodeproj/project.pbxproj | 115 +++++++--------------- 1 file changed, 38 insertions(+), 77 deletions(-) diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj index b38bfb01..23ddc33b 100644 --- a/YogaKit/YogaKit.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj @@ -387,6 +387,23 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + "ARCHS[sdk=appletvos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=appletvsimulator*]" = ( + i386, + x86_64, + ); + "ARCHS[sdk=iphoneos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=iphonesimulator*]" = ( + i386, + x86_64, + ); + "ARCHS[sdk=macosx*]" = x86_64; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -434,12 +451,17 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.6; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALID_ARCHS = "i386 x86_64 arm64 armv7 arm64e armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; @@ -447,6 +469,15 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + "ARCHS[sdk=appletvos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=iphoneos*]" = ( + arm64, + armv7, + ); + "ARCHS[sdk=macosx*]" = x86_64; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -488,38 +519,23 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.6; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; + TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; + VALID_ARCHS = "i386 x86_64 arm64 armv7 arm64e armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; 15865F5D24E5834E00345BD7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "ARCHS[sdk=appletvos*]" = ( - arm64, - armv7, - ); - "ARCHS[sdk=appletvsimulator*]" = ( - i386, - x86_64, - ); - "ARCHS[sdk=iphoneos*]" = ( - arm64, - armv7, - ); - "ARCHS[sdk=iphonesimulator*]" = ( - i386, - x86_64, - ); - "ARCHS[sdk=macosx*]" = ( - i386, - x86_64, - ); CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; @@ -527,38 +543,24 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "appletvsimulator appletvos iphoneos iphonesimulator macosx"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; - VALID_ARCHS = "i386 x86_64 arm64 armv7"; }; name = Debug; }; 15865F5E24E5834E00345BD7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "ARCHS[sdk=appletvos*]" = ( - arm64, - armv7, - ); - "ARCHS[sdk=iphoneos*]" = ( - arm64, - armv7, - ); - "ARCHS[sdk=macosx*]" = x86_64; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; @@ -566,102 +568,61 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "appletvsimulator appletvos iphoneos iphonesimulator macosx"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; - VALID_ARCHS = "i386 x86_64 arm64 armv7"; }; name = Release; }; 1586600424E58BD800345BD7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "ARCHS[sdk=appletvos*]" = ( - arm64, - armv7, - ); - "ARCHS[sdk=appletvsimulator*]" = ( - i386, - x86_64, - ); - "ARCHS[sdk=iphoneos*]" = ( - arm64, - armv7, - ); - "ARCHS[sdk=iphonesimulator*]" = ( - i386, - x86_64, - ); - "ARCHS[sdk=macosx*]" = x86_64; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "appletvsimulator appletvos iphoneos iphonesimulator macosx"; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; - VALID_ARCHS = "i386 x86_64 arm64 armv7"; }; name = Debug; }; 1586600524E58BD800345BD7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "ARCHS[sdk=appletvos*]" = ( - arm64, - armv7, - ); - "ARCHS[sdk=iphoneos*]" = ( - arm64, - armv7, - ); - "ARCHS[sdk=macosx*]" = x86_64; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "appletvsimulator appletvos iphoneos iphonesimulator macosx"; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; - VALID_ARCHS = "i386 x86_64 arm64 armv7"; }; name = Release; }; -- 2.50.1.windows.1 From 6a5faa41b9773f2a95f97f06e4fbc76063484e52 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 08:01:49 +0800 Subject: [PATCH 15/38] [YogaKit] update TARGETED_DEVICE_FAMILY --- YogaKit/YogaKit.xcodeproj/project.pbxproj | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj index 23ddc33b..40709356 100644 --- a/YogaKit/YogaKit.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj @@ -457,6 +457,7 @@ MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; + TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; VALID_ARCHS = "i386 x86_64 arm64 armv7 arm64e armv7s"; VERSIONING_SYSTEM = "apple-generic"; @@ -524,6 +525,7 @@ MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; + TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; VALID_ARCHS = "i386 x86_64 arm64 armv7 arm64e armv7s"; @@ -554,7 +556,6 @@ SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -578,7 +579,6 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; @@ -600,7 +600,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -622,7 +621,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; -- 2.50.1.windows.1 From a507c40621bda08a7dadc2b5b7dfeca59b2760d3 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 10:32:52 +0800 Subject: [PATCH 16/38] [YogaKit] add symbol link to yoga --- YogaKit/yoga | 1 + 1 file changed, 1 insertion(+) create mode 120000 YogaKit/yoga diff --git a/YogaKit/yoga b/YogaKit/yoga new file mode 120000 index 00000000..18cce15d --- /dev/null +++ b/YogaKit/yoga @@ -0,0 +1 @@ +../yoga \ No newline at end of file -- 2.50.1.windows.1 From 025f6a358fe246d920d90270ad318135f2f96eb0 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 13:17:05 +0800 Subject: [PATCH 17/38] [YogaKit] add YGLayoutExtensions.swift to YogaKit --- YogaKit/Yoga-umbrella.h | 11 +++++++++++ YogaKit/Yoga.modulemap | 6 ++++++ YogaKit/YogaKit.xcodeproj/project.pbxproj | 22 ++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 YogaKit/Yoga-umbrella.h create mode 100644 YogaKit/Yoga.modulemap diff --git a/YogaKit/Yoga-umbrella.h b/YogaKit/Yoga-umbrella.h new file mode 100644 index 00000000..37e7e8d5 --- /dev/null +++ b/YogaKit/Yoga-umbrella.h @@ -0,0 +1,11 @@ +#ifdef __OBJC__ +#import +#import +#endif + +#import "YGEnums.h" +#import "YGMacros.h" +#import "YGNode.h" +#import "YGStyle.h" +#import "YGValue.h" +#import "Yoga.h" diff --git a/YogaKit/Yoga.modulemap b/YogaKit/Yoga.modulemap new file mode 100644 index 00000000..6f06443c --- /dev/null +++ b/YogaKit/Yoga.modulemap @@ -0,0 +1,6 @@ +framework module Yoga [system][extern_c] { + umbrella header "Yoga-umbrella.h" + + export * + module * { export * } +} diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj index 40709356..66138aa5 100644 --- a/YogaKit/YogaKit.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 153D326F24E654A300EDDBEA /* Yoga-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 153D326E24E6549A00EDDBEA /* Yoga-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 153D327124E654EF00EDDBEA /* YGLayoutExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 153D327024E654EF00EDDBEA /* YGLayoutExtensions.swift */; }; 15865F6624E583F000345BD7 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F5F24E583F000345BD7 /* YGLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15865F6724E583F000345BD7 /* UIView+Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6024E583F000345BD7 /* UIView+Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15865F6824E583F000345BD7 /* YGLayout+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6124E583F000345BD7 /* YGLayout+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -57,6 +59,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 153D326D24E6549A00EDDBEA /* Yoga.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = Yoga.modulemap; sourceTree = ""; }; + 153D326E24E6549A00EDDBEA /* Yoga-umbrella.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Yoga-umbrella.h"; sourceTree = ""; }; + 153D327024E654EF00EDDBEA /* YGLayoutExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YGLayoutExtensions.swift; sourceTree = ""; }; 15865F5424E5834E00345BD7 /* YogaKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YogaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 15865F5F24E583F000345BD7 /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = ""; }; 15865F6024E583F000345BD7 /* UIView+Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Yoga.h"; sourceTree = ""; }; @@ -116,11 +121,21 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 153D326C24E6545A00EDDBEA /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 153D326E24E6549A00EDDBEA /* Yoga-umbrella.h */, + 153D326D24E6549A00EDDBEA /* Yoga.modulemap */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; 15865F4A24E5834E00345BD7 = { isa = PBXGroup; children = ( 15865F5624E5834E00345BD7 /* YogaKit */, 15865FFF24E58BD800345BD7 /* Yoga */, + 153D326C24E6545A00EDDBEA /* Supporting Files */, 15865F5524E5834E00345BD7 /* Products */, 15865FB824E584FF00345BD7 /* Frameworks */, ); @@ -138,6 +153,7 @@ 15865F5624E5834E00345BD7 /* YogaKit */ = { isa = PBXGroup; children = ( + 153D327024E654EF00EDDBEA /* YGLayoutExtensions.swift */, 15865F6024E583F000345BD7 /* UIView+Yoga.h */, 15865F6324E583F000345BD7 /* UIView+Yoga.m */, 15865F5F24E583F000345BD7 /* YGLayout.h */, @@ -234,6 +250,7 @@ 1586603D24E58C3700345BD7 /* YGMacros.h in Headers */, 1586604324E58C3700345BD7 /* YGValue.h in Headers */, 1586604024E58C3700345BD7 /* YGStyle.h in Headers */, + 153D326F24E654A300EDDBEA /* Yoga-umbrella.h in Headers */, 1586603124E58C3700345BD7 /* BitUtils.h in Headers */, 1586603024E58C3700345BD7 /* Utils.h in Headers */, 1586602B24E58C3700345BD7 /* experiments-inl.h in Headers */, @@ -348,6 +365,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 153D327124E654EF00EDDBEA /* YGLayoutExtensions.swift in Sources */, 15865F6A24E583F000345BD7 /* UIView+Yoga.m in Sources */, 15865F6924E583F000345BD7 /* YGLayout.m in Sources */, ); @@ -457,6 +475,7 @@ MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; VALID_ARCHS = "i386 x86_64 arm64 armv7 arm64e armv7s"; @@ -525,6 +544,7 @@ MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; + SWIFT_COMPILATION_MODE = wholemodule; TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -597,6 +617,7 @@ "@loader_path/Frameworks", ); MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "${SRCROOT}/Yoga.modulemap"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -618,6 +639,7 @@ "@loader_path/Frameworks", ); MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "${SRCROOT}/Yoga.modulemap"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Yoga; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; -- 2.50.1.windows.1 From 5521fb7149fc116dfe11d09cdc5731d463c099e5 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 13:49:50 +0800 Subject: [PATCH 18/38] [YogaKit] remove unused public headers from Yoga. --- Yoga.podspec | 2 +- YogaKit/YogaKitSample/Podfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Yoga.podspec b/Yoga.podspec index 75075fa6..69c8c2a3 100644 --- a/Yoga.podspec +++ b/Yoga.podspec @@ -33,6 +33,6 @@ Pod::Spec.new do |spec| '-fPIC' ] spec.source_files = 'yoga/**/*.{c,h,cpp}' - spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGNode,YGStyle,YGValue}.h' + spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue}.h' spec.static_framework = true end diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index 7ea86ac8..9d34a6a4 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -25,9 +25,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: IGListDiffKit: 665d6cf43ce726e676013db9c7d6c4294259b6b2 IGListKit: fd5a5d21935298f5849fa49d426843cff97b77c7 - Yoga: 66186cbdf82afe25cc8c9b9adc100667063a21e8 + Yoga: 21a6025b8ce1624d5bf5202b1af67cd43da8edfc YogaKit: 30573590c8d1ecd5c3758efba7117ad9cb1c8508 PODFILE CHECKSUM: 74e6863ea92d9031f0d141ef224a84ab74846efa -COCOAPODS: 1.9.3 +COCOAPODS: 1.9.1 -- 2.50.1.windows.1 From ee59c265bffdeb75e545f4db682e6a1e26a55b57 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 13:53:50 +0800 Subject: [PATCH 19/38] [YogaKit] remove unused umbrella headers from Yoga --- YogaKit/Yoga-umbrella.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/YogaKit/Yoga-umbrella.h b/YogaKit/Yoga-umbrella.h index 37e7e8d5..65171543 100644 --- a/YogaKit/Yoga-umbrella.h +++ b/YogaKit/Yoga-umbrella.h @@ -5,7 +5,5 @@ #import "YGEnums.h" #import "YGMacros.h" -#import "YGNode.h" -#import "YGStyle.h" #import "YGValue.h" #import "Yoga.h" -- 2.50.1.windows.1 From f7b77210bcb549ee54ff239d43a9d34731b027ad Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 13:55:12 +0800 Subject: [PATCH 20/38] [YogaKit] remove unused headers from project --- YogaKit/YogaKit.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj index 66138aa5..ba079022 100644 --- a/YogaKit/YogaKit.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj @@ -39,12 +39,12 @@ 1586603D24E58C3700345BD7 /* YGMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586601F24E58C3700345BD7 /* YGMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1586603E24E58C3700345BD7 /* YGEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602024E58C3700345BD7 /* YGEnums.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1586603F24E58C3700345BD7 /* log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586602124E58C3700345BD7 /* log.cpp */; }; - 1586604024E58C3700345BD7 /* YGStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602224E58C3700345BD7 /* YGStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1586604024E58C3700345BD7 /* YGStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602224E58C3700345BD7 /* YGStyle.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1586604124E58C3700345BD7 /* Yoga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586602324E58C3700345BD7 /* Yoga.cpp */; }; 1586604224E58C3700345BD7 /* Yoga-internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602424E58C3700345BD7 /* Yoga-internal.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1586604324E58C3700345BD7 /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602524E58C3700345BD7 /* YGValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1586604424E58C3700345BD7 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602624E58C3700345BD7 /* YGLayout.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 1586604524E58C3700345BD7 /* YGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602724E58C3700345BD7 /* YGNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1586604524E58C3700345BD7 /* YGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1586602724E58C3700345BD7 /* YGNode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1586604624E58C3700345BD7 /* YGEnums.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1586602824E58C3700345BD7 /* YGEnums.cpp */; }; /* End PBXBuildFile section */ @@ -244,13 +244,13 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 1586604524E58C3700345BD7 /* YGNode.h in Headers */, 1586603E24E58C3700345BD7 /* YGEnums.h in Headers */, 1586603A24E58C3700345BD7 /* Yoga.h in Headers */, 1586603D24E58C3700345BD7 /* YGMacros.h in Headers */, 1586604324E58C3700345BD7 /* YGValue.h in Headers */, - 1586604024E58C3700345BD7 /* YGStyle.h in Headers */, 153D326F24E654A300EDDBEA /* Yoga-umbrella.h in Headers */, + 1586604524E58C3700345BD7 /* YGNode.h in Headers */, + 1586604024E58C3700345BD7 /* YGStyle.h in Headers */, 1586603124E58C3700345BD7 /* BitUtils.h in Headers */, 1586603024E58C3700345BD7 /* Utils.h in Headers */, 1586602B24E58C3700345BD7 /* experiments-inl.h in Headers */, -- 2.50.1.windows.1 From b5b42bd6c5d9acabae25d8b9961e5e220e4daa74 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 14:07:40 +0800 Subject: [PATCH 21/38] [YogaKit] fix complie error with ObjC++ --- YogaKit/Source/YGLayout.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 0402152f..36a77c34 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -149,11 +149,11 @@ lowercased_name, capitalized_name, capitalized_name, YGEdgeAll) YGValue YGPointValue(CGFloat value) { - return (YGValue){.value = value, .unit = YGUnitPoint}; + return (YGValue){.value = (float)value, .unit = YGUnitPoint}; } YGValue YGPercentValue(CGFloat value) { - return (YGValue){.value = value, .unit = YGUnitPercent}; + return (YGValue){.value = (float)value, .unit = YGUnitPercent}; } static CGFloat YGScaleFactor() { @@ -407,9 +407,9 @@ static YGSize YGMeasureView( } return (YGSize){ - .width = YGSanitizeMeasurement( + .width = (float)YGSanitizeMeasurement( constrainedWidth, sizeThatFits.width, widthMode), - .height = YGSanitizeMeasurement( + .height = (float)YGSanitizeMeasurement( constrainedHeight, sizeThatFits.height, heightMode), }; } -- 2.50.1.windows.1 From 520b622e5c812e85706d29e0117f99217f0f2629 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 14:35:21 +0800 Subject: [PATCH 22/38] [Yoga] fix error: templates must have C++ linkage --- yoga/YGEnums.h | 4 ++++ yoga/YGMacros.h | 2 ++ yoga/YGValue.h | 4 ++++ yoga/Yoga.h | 2 ++ 4 files changed, 12 insertions(+) diff --git a/yoga/YGEnums.h b/yoga/YGEnums.h index 3dc458dc..8aa9c9a5 100644 --- a/yoga/YGEnums.h +++ b/yoga/YGEnums.h @@ -10,6 +10,7 @@ #include "YGMacros.h" #ifdef __cplusplus +YG_EXTERN_CXX_BEGIN namespace facebook { namespace yoga { namespace enums { @@ -27,6 +28,7 @@ constexpr int n() { } // namespace enums } // namespace yoga } // namespace facebook +YG_EXTERN_C_END #endif #define YG_ENUM_DECL(NAME, ...) \ @@ -37,6 +39,7 @@ constexpr int n() { #define YG_ENUM_SEQ_DECL(NAME, ...) \ YG_ENUM_DECL(NAME, __VA_ARGS__) \ YG_EXTERN_C_END \ + YG_EXTERN_CXX_BEGIN \ namespace facebook { \ namespace yoga { \ namespace enums { \ @@ -47,6 +50,7 @@ constexpr int n() { } \ } \ } \ + YG_EXTERN_C_END \ YG_EXTERN_C_BEGIN #else #define YG_ENUM_SEQ_DECL YG_ENUM_DECL diff --git a/yoga/YGMacros.h b/yoga/YGMacros.h index c6917f1b..7c102ab4 100644 --- a/yoga/YGMacros.h +++ b/yoga/YGMacros.h @@ -8,9 +8,11 @@ #pragma once #ifdef __cplusplus +#define YG_EXTERN_CXX_BEGIN extern "C++" { #define YG_EXTERN_C_BEGIN extern "C" { #define YG_EXTERN_C_END } #else +#define YG_EXTERN_CXX_BEGIN #define YG_EXTERN_C_BEGIN #define YG_EXTERN_C_END #endif diff --git a/yoga/YGValue.h b/yoga/YGValue.h index a2000978..93865ac4 100644 --- a/yoga/YGValue.h +++ b/yoga/YGValue.h @@ -15,8 +15,10 @@ #define COMPILING_WITH_CLANG_ON_WINDOWS #endif #if defined(COMPILING_WITH_CLANG_ON_WINDOWS) +YG_EXTERN_CXX_BEGIN #include constexpr float YGUndefined = std::numeric_limits::quiet_NaN(); +YG_EXTERN_C_END #else YG_EXTERN_C_BEGIN @@ -44,6 +46,7 @@ YG_EXTERN_C_END #undef COMPILING_WITH_CLANG_ON_WINDOWS #ifdef __cplusplus +YG_EXTERN_CXX_BEGIN inline bool operator==(const YGValue& lhs, const YGValue& rhs) { if (lhs.unit != rhs.unit) { @@ -92,4 +95,5 @@ inline YGValue operator"" _percent(unsigned long long value) { } // namespace yoga } // namespace facebook +YG_EXTERN_C_END #endif diff --git a/yoga/Yoga.h b/yoga/Yoga.h index 87901a28..36331622 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -360,6 +360,7 @@ WIN_EXPORT float YGRoundValueToPixelGrid( YG_EXTERN_C_END #ifdef __cplusplus +YG_EXTERN_CXX_BEGIN #include #include @@ -371,4 +372,5 @@ void YGTraversePreOrder( void YGNodeSetChildren(YGNodeRef owner, const std::vector& children); +YG_EXTERN_C_END #endif -- 2.50.1.windows.1 From 7c940ac51f2fd729173e43616a281de14400c4af Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 17:51:47 +0800 Subject: [PATCH 23/38] [YogaKit] rollback implementation of YGRoundPixelValue --- YogaKit/Source/YGLayout.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 36a77c34..1cec9575 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -488,8 +488,7 @@ static void YGRemoveAllChildren(const YGNodeRef node) { static CGFloat YGRoundPixelValue(CGFloat value) { CGFloat scale = YGScaleFactor(); - - return ceil(value * scale) / scale; // Pixel-align + return round(value * scale) / scale; } static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { -- 2.50.1.windows.1 From 656a98b149c849b1e2c4ad74465a96fb6c883349 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 19:24:55 +0800 Subject: [PATCH 24/38] =?UTF-8?q?[YogaKit]=20align=20pixel=20for=20view?= =?UTF-8?q?=E2=80=99s=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YogaKit/Source/YGLayout.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 1cec9575..647a3a34 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -491,6 +491,11 @@ static CGFloat YGRoundPixelValue(CGFloat value) { return round(value * scale) / scale; } +static CGFloat YGAlignPixelValue(CGFloat value) { + CGFloat scale = YGScaleFactor(); + return ceil(value * scale) / scale; +} + static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { NSCAssert( [NSThread isMainThread], @@ -555,12 +560,12 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { view.frame = (CGRect) { .origin = CGPointMake(YGRoundPixelValue(frame.origin.x), YGRoundPixelValue(frame.origin.y)), - .size = CGSizeMake(YGRoundPixelValue(frame.size.width), YGRoundPixelValue(frame.size.height)) + .size = CGSizeMake(YGAlignPixelValue(frame.size.width), YGAlignPixelValue(frame.size.height)) }; #else view.bounds = (CGRect) { .origin = view.bounds.origin, - .size = CGSizeMake(YGRoundPixelValue(CGRectGetWidth(frame)), YGRoundPixelValue(CGRectGetHeight(frame))) + .size = CGSizeMake(YGAlignPixelValue(CGRectGetWidth(frame)), YGAlignPixelValue(CGRectGetHeight(frame))) }; view.center = (CGPoint) { -- 2.50.1.windows.1 From 98420460d90a72cf23d74429772268c23938821d Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 19:49:16 +0800 Subject: [PATCH 25/38] [YogaKit] add unit tests to YogaKit.xcodeproj --- YogaKit/Tests/Info.plist | 12 +- YogaKit/Tests/dummy.swift | 2 + YogaKit/YogaKit.xcodeproj/project.pbxproj | 155 ++++++++++++++- .../YogaKitSample.xcodeproj/project.pbxproj | 180 ------------------ .../YogaKitSampleTests/dummy.swift | 1 - 5 files changed, 160 insertions(+), 190 deletions(-) create mode 100644 YogaKit/Tests/dummy.swift delete mode 100644 YogaKit/YogaKitSample/YogaKitSampleTests/dummy.swift diff --git a/YogaKit/Tests/Info.plist b/YogaKit/Tests/Info.plist index c317ef52..64d65ca4 100644 --- a/YogaKit/Tests/Info.plist +++ b/YogaKit/Tests/Info.plist @@ -3,19 +3,19 @@ CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) CFBundleExecutable - ${EXECUTABLE_NAME} + $(EXECUTABLE_NAME) CFBundleIdentifier - com.facebook.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 + CFBundleName + $(PRODUCT_NAME) CFBundlePackageType - BNDL + $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion 1 diff --git a/YogaKit/Tests/dummy.swift b/YogaKit/Tests/dummy.swift new file mode 100644 index 00000000..3fcf602f --- /dev/null +++ b/YogaKit/Tests/dummy.swift @@ -0,0 +1,2 @@ +class YogaKitTestsDummy { +} diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj index ba079022..f9825805 100644 --- a/YogaKit/YogaKit.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj @@ -3,12 +3,17 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ + 153B526524E6AD8D008156D3 /* YogaKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 153B526324E6AD8D008156D3 /* YogaKitTests.m */; }; + 153B526B24E6ADFA008156D3 /* Yoga.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15865FFE24E58BD800345BD7 /* Yoga.framework */; platformFilter = ios; }; + 153B526C24E6ADFA008156D3 /* YogaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15865F5424E5834E00345BD7 /* YogaKit.framework */; platformFilter = ios; }; + 153B526E24E6AECF008156D3 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 153B526D24E6AECF008156D3 /* libc++.tbd */; platformFilter = ios; }; 153D326F24E654A300EDDBEA /* Yoga-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 153D326E24E6549A00EDDBEA /* Yoga-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 153D327124E654EF00EDDBEA /* YGLayoutExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 153D327024E654EF00EDDBEA /* YGLayoutExtensions.swift */; }; + 154A6EF524E6B1260091264C /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 154A6EF424E6B1260091264C /* dummy.swift */; }; 15865F6624E583F000345BD7 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F5F24E583F000345BD7 /* YGLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15865F6724E583F000345BD7 /* UIView+Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6024E583F000345BD7 /* UIView+Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15865F6824E583F000345BD7 /* YGLayout+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15865F6124E583F000345BD7 /* YGLayout+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -49,6 +54,20 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 153B526724E6ADF4008156D3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15865F4B24E5834E00345BD7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 15865FFD24E58BD800345BD7; + remoteInfo = Yoga; + }; + 153B526924E6ADF4008156D3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15865F4B24E5834E00345BD7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 15865F5324E5834E00345BD7; + remoteInfo = YogaKit; + }; 1586600624E58C0900345BD7 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 15865F4B24E5834E00345BD7 /* Project object */; @@ -59,9 +78,14 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 153B525B24E6AD6B008156D3 /* YogaKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 153B526324E6AD8D008156D3 /* YogaKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = YogaKitTests.m; path = Tests/YogaKitTests.m; sourceTree = SOURCE_ROOT; }; + 153B526424E6AD8D008156D3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = Info.plist; path = Tests/Info.plist; sourceTree = SOURCE_ROOT; }; + 153B526D24E6AECF008156D3 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; 153D326D24E6549A00EDDBEA /* Yoga.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = Yoga.modulemap; sourceTree = ""; }; 153D326E24E6549A00EDDBEA /* Yoga-umbrella.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Yoga-umbrella.h"; sourceTree = ""; }; 153D327024E654EF00EDDBEA /* YGLayoutExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YGLayoutExtensions.swift; sourceTree = ""; }; + 154A6EF424E6B1260091264C /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = dummy.swift; path = Tests/dummy.swift; sourceTree = SOURCE_ROOT; }; 15865F5424E5834E00345BD7 /* YogaKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YogaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 15865F5F24E583F000345BD7 /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = ""; }; 15865F6024E583F000345BD7 /* UIView+Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Yoga.h"; sourceTree = ""; }; @@ -103,6 +127,16 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 153B525824E6AD6B008156D3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 153B526E24E6AECF008156D3 /* libc++.tbd in Frameworks */, + 153B526B24E6ADFA008156D3 /* Yoga.framework in Frameworks */, + 153B526C24E6ADFA008156D3 /* YogaKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 15865F5124E5834E00345BD7 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -121,6 +155,16 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 153B525C24E6AD6B008156D3 /* YogaKitTests */ = { + isa = PBXGroup; + children = ( + 153B526424E6AD8D008156D3 /* Info.plist */, + 153B526324E6AD8D008156D3 /* YogaKitTests.m */, + 154A6EF424E6B1260091264C /* dummy.swift */, + ); + path = YogaKitTests; + sourceTree = ""; + }; 153D326C24E6545A00EDDBEA /* Supporting Files */ = { isa = PBXGroup; children = ( @@ -136,6 +180,7 @@ 15865F5624E5834E00345BD7 /* YogaKit */, 15865FFF24E58BD800345BD7 /* Yoga */, 153D326C24E6545A00EDDBEA /* Supporting Files */, + 153B525C24E6AD6B008156D3 /* YogaKitTests */, 15865F5524E5834E00345BD7 /* Products */, 15865FB824E584FF00345BD7 /* Frameworks */, ); @@ -146,6 +191,7 @@ children = ( 15865F5424E5834E00345BD7 /* YogaKit.framework */, 15865FFE24E58BD800345BD7 /* Yoga.framework */, + 153B525B24E6AD6B008156D3 /* YogaKitTests.xctest */, ); name = Products; sourceTree = ""; @@ -168,6 +214,7 @@ 15865FB824E584FF00345BD7 /* Frameworks */ = { isa = PBXGroup; children = ( + 153B526D24E6AECF008156D3 /* libc++.tbd */, ); name = Frameworks; sourceTree = ""; @@ -269,6 +316,25 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 153B525A24E6AD6B008156D3 /* YogaKitTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 153B526024E6AD6B008156D3 /* Build configuration list for PBXNativeTarget "YogaKitTests" */; + buildPhases = ( + 153B525724E6AD6B008156D3 /* Sources */, + 153B525824E6AD6B008156D3 /* Frameworks */, + 153B525924E6AD6B008156D3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 153B526824E6ADF4008156D3 /* PBXTargetDependency */, + 153B526A24E6ADF4008156D3 /* PBXTargetDependency */, + ); + name = YogaKitTests; + productName = YogaKitTests; + productReference = 153B525B24E6AD6B008156D3 /* YogaKitTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 15865F5324E5834E00345BD7 /* YogaKit */ = { isa = PBXNativeTarget; buildConfigurationList = 15865F5C24E5834E00345BD7 /* Build configuration list for PBXNativeTarget "YogaKit" */; @@ -315,6 +381,10 @@ LastUpgradeCheck = 1160; ORGANIZATIONNAME = facebook; TargetAttributes = { + 153B525A24E6AD6B008156D3 = { + CreatedOnToolsVersion = 11.6; + LastSwiftMigration = 1160; + }; 15865F5324E5834E00345BD7 = { CreatedOnToolsVersion = 11.6; LastSwiftMigration = 1160; @@ -339,11 +409,19 @@ targets = ( 15865F5324E5834E00345BD7 /* YogaKit */, 15865FFD24E58BD800345BD7 /* Yoga */, + 153B525A24E6AD6B008156D3 /* YogaKitTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 153B525924E6AD6B008156D3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 15865F5224E5834E00345BD7 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -361,6 +439,15 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 153B525724E6AD6B008156D3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 154A6EF524E6B1260091264C /* dummy.swift in Sources */, + 153B526524E6AD8D008156D3 /* YogaKitTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 15865F5024E5834E00345BD7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -393,6 +480,18 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 153B526824E6ADF4008156D3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + platformFilter = ios; + target = 15865FFD24E58BD800345BD7 /* Yoga */; + targetProxy = 153B526724E6ADF4008156D3 /* PBXContainerItemProxy */; + }; + 153B526A24E6ADF4008156D3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + platformFilter = ios; + target = 15865F5324E5834E00345BD7 /* YogaKit */; + targetProxy = 153B526924E6ADF4008156D3 /* PBXContainerItemProxy */; + }; 1586600724E58C0900345BD7 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 15865FFD24E58BD800345BD7 /* Yoga */; @@ -401,6 +500,47 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 153B526124E6AD6B008156D3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = "${SRCROOT}/Tests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 153B526224E6AD6B008156D3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = "${SRCROOT}/Tests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; 15865F5A24E5834E00345BD7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -476,6 +616,7 @@ ONLY_ACTIVE_ARCH = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; VALID_ARCHS = "i386 x86_64 arm64 armv7 arm64e armv7s"; @@ -545,6 +686,7 @@ MTL_FAST_MATH = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -575,7 +717,6 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -598,7 +739,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; }; name = Release; }; @@ -649,6 +789,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 153B526024E6AD6B008156D3 /* Build configuration list for PBXNativeTarget "YogaKitTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 153B526124E6AD6B008156D3 /* Debug */, + 153B526224E6AD6B008156D3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 15865F4E24E5834E00345BD7 /* Build configuration list for PBXProject "YogaKit" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj index bf117fa3..b379ab01 100644 --- a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj @@ -10,8 +10,6 @@ 13687D531DF8748400E7C260 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13687D521DF8748400E7C260 /* Assets.xcassets */; }; 13687D851DF87D1E00E7C260 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D841DF87D1E00E7C260 /* UIKit.framework */; }; 13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D861DF87D2400E7C260 /* Foundation.framework */; }; - 151960FA24E5314C00F7BF06 /* YogaKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 151960F924E5314C00F7BF06 /* YogaKitTests.m */; }; - 151960FC24E532B700F7BF06 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 151960FB24E532B700F7BF06 /* dummy.swift */; }; 15865F3524E56F7800345BD7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 15865F3424E56F7800345BD7 /* AppDelegate.m */; }; 15865F3824E56F7800345BD7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15865F3724E56F7800345BD7 /* ViewController.m */; }; 15865F3A24E56F7800345BD7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 15865F3924E56F7800345BD7 /* Assets.xcassets */; }; @@ -29,7 +27,6 @@ 15E1C34A24E568420086A4E6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C34924E568420086A4E6 /* main.m */; }; 15E1C34F24E56A8A0086A4E6 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C34E24E56A8A0086A4E6 /* dummy.swift */; }; 15E1C35124E56AB60086A4E6 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 15E1C35024E56AB60086A4E6 /* libc++.tbd */; }; - 1D885DC3D17809A4C3E245F3 /* Pods_YogaKitSampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB0C63590A97352D30E310E /* Pods_YogaKitSampleTests.framework */; }; 40BD9F461E477A09002790A9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F451E477A09002790A9 /* AppDelegate.swift */; }; 40BD9F4B1E47850C002790A9 /* BasicViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F4A1E47850C002790A9 /* BasicViewController.swift */; }; 40BD9F501E479079002790A9 /* SingleLabelCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F4F1E479079002790A9 /* SingleLabelCollectionCell.swift */; }; @@ -38,16 +35,6 @@ FF76EAD6A7089159C35EED45 /* Pods_YogaKitTVSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8925233409AB43504C102C31 /* Pods_YogaKitTVSample.framework */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 151960F424E530E700F7BF06 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13687D3B1DF8748300E7C260 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13687D421DF8748300E7C260; - remoteInfo = YogaKitSample; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXCopyFilesBuildPhase section */ 13687D771DF878A000E7C260 /* yoga */ = { isa = PBXCopyFilesBuildPhase; @@ -78,9 +65,6 @@ 13687D571DF8748400E7C260 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 13687D841DF87D1E00E7C260 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 13687D861DF87D2400E7C260 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 151960F924E5314C00F7BF06 /* YogaKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = YogaKitTests.m; path = ../../Tests/YogaKitTests.m; sourceTree = ""; }; - 151960FB24E532B700F7BF06 /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = ""; }; 15865F3124E56F7800345BD7 /* YogaKitOSXSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YogaKitOSXSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 15865F3324E56F7800345BD7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 15865F3424E56F7800345BD7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -135,14 +119,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 151960EC24E530E700F7BF06 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D885DC3D17809A4C3E245F3 /* Pods_YogaKitSampleTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 15865F2E24E56F7800345BD7 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -168,7 +144,6 @@ isa = PBXGroup; children = ( 13687D451DF8748400E7C260 /* YogaKitSample */, - 151960F024E530E700F7BF06 /* YogaKitSampleTests */, 15E1C33924E568410086A4E6 /* YogaKitTVSample */, 15865F3224E56F7800345BD7 /* YogaKitOSXSample */, 13687D441DF8748400E7C260 /* Products */, @@ -181,7 +156,6 @@ isa = PBXGroup; children = ( 13687D431DF8748400E7C260 /* YogaKitSample.app */, - 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */, 15E1C33824E568410086A4E6 /* YogaKitTVSample.app */, 15865F3124E56F7800345BD7 /* YogaKitOSXSample.app */, ); @@ -217,15 +191,6 @@ name = Frameworks; sourceTree = ""; }; - 151960F024E530E700F7BF06 /* YogaKitSampleTests */ = { - isa = PBXGroup; - children = ( - 151960F924E5314C00F7BF06 /* YogaKitTests.m */, - 151960FB24E532B700F7BF06 /* dummy.swift */, - ); - path = YogaKitSampleTests; - sourceTree = ""; - }; 15865F3224E56F7800345BD7 /* YogaKitOSXSample */ = { isa = PBXGroup; children = ( @@ -316,25 +281,6 @@ productReference = 13687D431DF8748400E7C260 /* YogaKitSample.app */; productType = "com.apple.product-type.application"; }; - 151960EE24E530E700F7BF06 /* YogaKitSampleTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 151960F624E530E700F7BF06 /* Build configuration list for PBXNativeTarget "YogaKitSampleTests" */; - buildPhases = ( - 6762F7581996BBCD3BC8BC43 /* [CP] Check Pods Manifest.lock */, - 151960EB24E530E700F7BF06 /* Sources */, - 151960EC24E530E700F7BF06 /* Frameworks */, - 151960ED24E530E700F7BF06 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 151960F524E530E700F7BF06 /* PBXTargetDependency */, - ); - name = YogaKitSampleTests; - productName = YogaKitSampleTests; - productReference = 151960EF24E530E700F7BF06 /* YogaKitSampleTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; 15865F3024E56F7800345BD7 /* YogaKitOSXSample */ = { isa = PBXNativeTarget; buildConfigurationList = 15865F4424E56F7800345BD7 /* Build configuration list for PBXNativeTarget "YogaKitOSXSample" */; @@ -385,12 +331,6 @@ LastSwiftMigration = 0820; ProvisioningStyle = Automatic; }; - 151960EE24E530E700F7BF06 = { - CreatedOnToolsVersion = 11.6; - LastSwiftMigration = 1160; - ProvisioningStyle = Automatic; - TestTargetID = 13687D421DF8748300E7C260; - }; 15865F3024E56F7800345BD7 = { CreatedOnToolsVersion = 11.6; LastSwiftMigration = 1160; @@ -418,7 +358,6 @@ projectRoot = ""; targets = ( 13687D421DF8748300E7C260 /* YogaKitSample */, - 151960EE24E530E700F7BF06 /* YogaKitSampleTests */, 15E1C33724E568410086A4E6 /* YogaKitTVSample */, 15865F3024E56F7800345BD7 /* YogaKitOSXSample */, ); @@ -434,13 +373,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 151960ED24E530E700F7BF06 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 15865F2F24E56F7800345BD7 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -503,28 +435,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 6762F7581996BBCD3BC8BC43 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-YogaKitSampleTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; EEAEE027484A739D2AFF1F33 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -582,15 +492,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 151960EB24E530E700F7BF06 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 151960FC24E532B700F7BF06 /* dummy.swift in Sources */, - 151960FA24E5314C00F7BF06 /* YogaKitTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 15865F2D24E56F7800345BD7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -615,14 +516,6 @@ }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 151960F524E530E700F7BF06 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13687D421DF8748300E7C260 /* YogaKitSample */; - targetProxy = 151960F424E530E700F7BF06 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ 15865F3B24E56F7800345BD7 /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -782,70 +675,6 @@ }; name = Release; }; - 151960F724E530E700F7BF06 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A26128CF4F9CAE93983FF74F /* Pods-YogaKitSampleTests.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - GCC_C_LANGUAGE_STANDARD = gnu11; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSampleTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YogaKitSample.app/YogaKitSample"; - }; - name = Debug; - }; - 151960F824E530E700F7BF06 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FF607399A6E2DE06593D1FA8 /* Pods-YogaKitSampleTests.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - GCC_C_LANGUAGE_STANDARD = gnu11; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSampleTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YogaKitSample.app/YogaKitSample"; - }; - name = Release; - }; 15865F4224E56F7800345BD7 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 6D7F92331FB484D6ED42C5E9 /* Pods-YogaKitOSXSample.debug.xcconfig */; @@ -1001,15 +830,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 151960F624E530E700F7BF06 /* Build configuration list for PBXNativeTarget "YogaKitSampleTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 151960F724E530E700F7BF06 /* Debug */, - 151960F824E530E700F7BF06 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 15865F4424E56F7800345BD7 /* Build configuration list for PBXNativeTarget "YogaKitOSXSample" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/YogaKit/YogaKitSample/YogaKitSampleTests/dummy.swift b/YogaKit/YogaKitSample/YogaKitSampleTests/dummy.swift deleted file mode 100644 index 8b137891..00000000 --- a/YogaKit/YogaKitSample/YogaKitSampleTests/dummy.swift +++ /dev/null @@ -1 +0,0 @@ - -- 2.50.1.windows.1 From f8ff6d8ac7c6c9d4dc78360cdd2a62120740b2ec Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 19:51:22 +0800 Subject: [PATCH 26/38] [YogaKit] remove YogaKitSampleTests from Podfile --- YogaKit/YogaKitSample/Podfile | 8 +------- YogaKit/YogaKitSample/Podfile.lock | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/YogaKit/YogaKitSample/Podfile b/YogaKit/YogaKitSample/Podfile index 86049996..78d33ffb 100644 --- a/YogaKit/YogaKitSample/Podfile +++ b/YogaKit/YogaKitSample/Podfile @@ -8,12 +8,6 @@ target 'YogaKitSample' do pod 'IGListKit', '~> 4.0.0' end -target 'YogaKitSampleTests' do - platform :ios, '9.0' - pod 'Yoga', :path => '../../Yoga.podspec' - pod 'YogaKit', :path => '../../YogaKit.podspec' -end - target 'YogaKitTVSample' do platform :tvos, '9.0' pod 'Yoga', :path => '../../Yoga.podspec' @@ -24,4 +18,4 @@ target 'YogaKitOSXSample' do platform :osx, '10.10' pod 'Yoga', :path => '../../Yoga.podspec' pod 'YogaKit', :path => '../../YogaKit.podspec' -end \ No newline at end of file +end diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index 9d34a6a4..077c4596 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -28,6 +28,6 @@ SPEC CHECKSUMS: Yoga: 21a6025b8ce1624d5bf5202b1af67cd43da8edfc YogaKit: 30573590c8d1ecd5c3758efba7117ad9cb1c8508 -PODFILE CHECKSUM: 74e6863ea92d9031f0d141ef224a84ab74846efa +PODFILE CHECKSUM: e8d71f0fe05bb5e3cfd81b54d07bd1a904e18968 COCOAPODS: 1.9.1 -- 2.50.1.windows.1 From c3ec27ede12cf50fedc158e9e14b3a64ef56433e Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 21:52:54 +0800 Subject: [PATCH 27/38] [YogaKit] build YogaKit with ObjC++17 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove YGRoundPixelValue for view’s origin - check view’s isYogaEnabled before check view.yoga.isEnabled --- YogaKit/Source/YGLayout.m | 21 +++++++++------------ YogaKit/YogaKit.xcodeproj/project.pbxproj | 8 ++++++-- YogaKit/YogaKitSample/Podfile.lock | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 647a3a34..317f5caa 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -243,9 +243,11 @@ static YGConfigRef YGGlobalConfig() { @"This method must be called on the main thread."); if (self.isEnabled) { for (UIView* subview in self.view.subviews) { - YGLayout* const yoga = subview.yoga; - if (yoga.isEnabled && yoga.isIncludedInLayout) { - return NO; + if (subview.isYogaEnabled) { + YGLayout* const yoga = subview.yoga; + if (yoga.isEnabled && yoga.isIncludedInLayout) { + return NO; + } } } } @@ -460,7 +462,7 @@ static void YGAttachNodesFromViewHierachy(UIView* const view) { NSMutableArray* subviewsToInclude = [[NSMutableArray alloc] initWithCapacity:view.subviews.count]; for (UIView* subview in view.subviews) { - if (subview.yoga.isEnabled && subview.yoga.isIncludedInLayout) { + if (subview.isYogaEnabled && subview.yoga.isEnabled && subview.yoga.isIncludedInLayout) { [subviewsToInclude addObject:subview]; } } @@ -486,11 +488,6 @@ static void YGRemoveAllChildren(const YGNodeRef node) { YGNodeRemoveAllChildren(node); } -static CGFloat YGRoundPixelValue(CGFloat value) { - CGFloat scale = YGScaleFactor(); - return round(value * scale) / scale; -} - static CGFloat YGAlignPixelValue(CGFloat value) { CGFloat scale = YGScaleFactor(); return ceil(value * scale) / scale; @@ -559,7 +556,7 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { } view.frame = (CGRect) { - .origin = CGPointMake(YGRoundPixelValue(frame.origin.x), YGRoundPixelValue(frame.origin.y)), + .origin = frame.origin, .size = CGSizeMake(YGAlignPixelValue(frame.size.width), YGAlignPixelValue(frame.size.height)) }; #else @@ -569,8 +566,8 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { }; view.center = (CGPoint) { - .x = YGRoundPixelValue(CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5), - .y = YGRoundPixelValue(CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5) + .x = CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5, + .y = CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5 }; #endif diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj index f9825805..53edb680 100644 --- a/YogaKit/YogaKit.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj @@ -564,7 +564,7 @@ "ARCHS[sdk=macosx*]" = x86_64; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -641,7 +641,7 @@ "ARCHS[sdk=macosx*]" = x86_64; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -706,6 +706,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -729,6 +730,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -750,6 +752,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_INPUT_FILETYPE = sourcecode.cpp.cpp; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -772,6 +775,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_INPUT_FILETYPE = sourcecode.cpp.cpp; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index 077c4596..048f6dde 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -30,4 +30,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: e8d71f0fe05bb5e3cfd81b54d07bd1a904e18968 -COCOAPODS: 1.9.1 +COCOAPODS: 1.9.3 -- 2.50.1.windows.1 From 257a79993d421c56f1f5def85cd74c67461a411e Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 22:08:46 +0800 Subject: [PATCH 28/38] [YogaKit] rollback gnu++17 to gnu++14 - fix gnu++17 complie error: noexcept' is only available on iOS 11 or newer --- YogaKit/YogaKit.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj index 53edb680..a9d07c20 100644 --- a/YogaKit/YogaKit.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj @@ -564,7 +564,7 @@ "ARCHS[sdk=macosx*]" = x86_64; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -641,7 +641,7 @@ "ARCHS[sdk=macosx*]" = x86_64; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; -- 2.50.1.windows.1 From c302e34ee037e1d0c8b7c89d0fe87ae800341ed8 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 22:17:54 +0800 Subject: [PATCH 29/38] [YogaKit] fix complie error with -Wc++11-narrowing --- YogaKit/Source/YGLayout.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 317f5caa..531823ba 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -522,8 +522,8 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { } : CGPointZero; const CGPoint bottomRight = { - topLeft.x + YGNodeLayoutGetWidth(node), - topLeft.y + YGNodeLayoutGetHeight(node), + .x = (CGFloat)(topLeft.x + YGNodeLayoutGetWidth(node)), + .y = (CGFloat)(topLeft.y + YGNodeLayoutGetHeight(node)), }; #if TARGET_OS_OSX @@ -531,8 +531,8 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { #else // use bounds/center and not frame if non-identity transform. const CGPoint origin = preserveOrigin ? (CGPoint) { - .x = view.center.x - CGRectGetWidth(view.bounds) * 0.5, - .y = view.center.y - CGRectGetHeight(view.bounds) * 0.5 + .x = (CGFloat)(view.center.x - CGRectGetWidth(view.bounds) * 0.5), + .y = (CGFloat)(view.center.y - CGRectGetHeight(view.bounds) * 0.5) } : CGPointZero; #endif @@ -552,7 +552,7 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { #if TARGET_OS_OSX if (!view.superview.isFlipped && view.superview.isYogaEnabled && view.superview.yoga.isEnabled) { - frame.origin.y = YGNodeLayoutGetHeight(view.superview.yoga.node) - CGRectGetMaxY(frame); + frame.origin.y = (CGFloat)(YGNodeLayoutGetHeight(view.superview.yoga.node) - CGRectGetMaxY(frame)); } view.frame = (CGRect) { @@ -566,8 +566,8 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { }; view.center = (CGPoint) { - .x = CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5, - .y = CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5 + .x = (CGFloat)(CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5), + .y = (CGFloat)(CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5) }; #endif -- 2.50.1.windows.1 From 31fc173ee0721f9e46e25eb88ec5fca0d4eb148b Mon Sep 17 00:00:00 2001 From: vvveiii Date: Fri, 14 Aug 2020 22:33:17 +0800 Subject: [PATCH 30/38] [YogaKit] fix complie error for tvOS --- YogaKit/YogaKit.xcodeproj/project.pbxproj | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj index a9d07c20..a1c4ed66 100644 --- a/YogaKit/YogaKit.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKit.xcodeproj/project.pbxproj @@ -545,14 +545,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - "ARCHS[sdk=appletvos*]" = ( - arm64, - armv7, - ); - "ARCHS[sdk=appletvsimulator*]" = ( - i386, - x86_64, - ); + "ARCHS[sdk=appletvos*]" = arm64; + "ARCHS[sdk=appletvsimulator*]" = x86_64; "ARCHS[sdk=iphoneos*]" = ( arm64, armv7, @@ -630,10 +624,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - "ARCHS[sdk=appletvos*]" = ( - arm64, - armv7, - ); + "ARCHS[sdk=appletvos*]" = arm64; "ARCHS[sdk=iphoneos*]" = ( arm64, armv7, -- 2.50.1.windows.1 From b498714d48c9ed4ff9d1626bab40cc43f73813c4 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Sat, 15 Aug 2020 10:18:54 +0800 Subject: [PATCH 31/38] =?UTF-8?q?[YogaKit]=20round-pixel=20view=E2=80=99s?= =?UTF-8?q?=20bounds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YogaKit/Source/YGLayout.m | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 531823ba..7acdc64a 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -488,9 +488,14 @@ static void YGRemoveAllChildren(const YGNodeRef node) { YGNodeRemoveAllChildren(node); } -static CGFloat YGAlignPixelValue(CGFloat value) { +static inline CGPoint YGRoundPixelPosition(CGPoint p) { CGFloat scale = YGScaleFactor(); - return ceil(value * scale) / scale; + return (CGPoint) { .x = round(p.x * scale) / scale, .y = round(p.y * scale) / scale }; +} + +static inline CGSize YGAlignPixelSize(CGSize s) { + CGFloat scale = YGScaleFactor(); + return (CGSize) { .width = ceil(s.width * scale) / scale, .height = ceil(s.height * scale) / scale }; } static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { @@ -537,17 +542,9 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { : CGPointZero; #endif - CGRect frame = (CGRect){ - .origin = - { - .x = topLeft.x + origin.x, - .y = topLeft.y + origin.y, - }, - .size = - { - .width = MAX(bottomRight.x - topLeft.x, 0), - .height = MAX(bottomRight.y - topLeft.y, 0), - }, + CGRect frame = (CGRect) { + .origin = (CGPoint) { .x = topLeft.x + origin.x, .y = topLeft.y + origin.y, }, + .size = (CGSize) { .width = MAX(bottomRight.x - topLeft.x, 0), .height = MAX(bottomRight.y - topLeft.y, 0), } }; #if TARGET_OS_OSX @@ -556,19 +553,19 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { } view.frame = (CGRect) { - .origin = frame.origin, - .size = CGSizeMake(YGAlignPixelValue(frame.size.width), YGAlignPixelValue(frame.size.height)) + .origin = YGRoundPixelPosition(frame.origin), + .size = YGAlignPixelSize(frame.size) }; #else view.bounds = (CGRect) { .origin = view.bounds.origin, - .size = CGSizeMake(YGAlignPixelValue(CGRectGetWidth(frame)), YGAlignPixelValue(CGRectGetHeight(frame))) + .size = YGAlignPixelSize(frame.size) }; - view.center = (CGPoint) { - .x = (CGFloat)(CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5), - .y = (CGFloat)(CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5) - }; + view.center = YGRoundPixelPosition((CGPoint) { + .x = CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5, + .y = CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5 + }); #endif if (!yoga.isLeaf) { -- 2.50.1.windows.1 From 029b877d2ef46cf4c5c8307d6c8911b185f41527 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Sat, 15 Aug 2020 14:52:10 +0800 Subject: [PATCH 32/38] [Yoga] replace float with YGFloat - pass all unit tests --- YogaKit/Source/YGLayout.m | 23 +- YogaKit/Tests/YogaKitTests.m | 12 + yoga/Utils.cpp | 12 +- yoga/Utils.h | 36 +-- yoga/YGConfig.h | 2 +- yoga/YGFloatOptional.h | 14 +- yoga/YGLayout.h | 12 +- yoga/YGMacros.h | 15 ++ yoga/YGNode.cpp | 52 ++-- yoga/YGNode.h | 54 ++-- yoga/YGValue.h | 2 +- yoga/Yoga-internal.h | 22 +- yoga/Yoga.cpp | 492 +++++++++++++++++------------------ yoga/Yoga.h | 114 ++++---- yoga/event/event.h | 8 +- 15 files changed, 446 insertions(+), 424 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 7acdc64a..b3baa8f5 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -375,9 +375,9 @@ YG_PROPERTY(CGFloat, aspectRatio, AspectRatio) static YGSize YGMeasureView( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { const CGFloat constrainedWidth = (widthMode == YGMeasureModeUndefined) ? CGFLOAT_MAX : width; @@ -409,9 +409,9 @@ static YGSize YGMeasureView( } return (YGSize){ - .width = (float)YGSanitizeMeasurement( + .width = (YGFloat)YGSanitizeMeasurement( constrainedWidth, sizeThatFits.width, widthMode), - .height = (float)YGSanitizeMeasurement( + .height = (YGFloat)YGSanitizeMeasurement( constrainedHeight, sizeThatFits.height, heightMode), }; } @@ -488,11 +488,6 @@ static void YGRemoveAllChildren(const YGNodeRef node) { YGNodeRemoveAllChildren(node); } -static inline CGPoint YGRoundPixelPosition(CGPoint p) { - CGFloat scale = YGScaleFactor(); - return (CGPoint) { .x = round(p.x * scale) / scale, .y = round(p.y * scale) / scale }; -} - static inline CGSize YGAlignPixelSize(CGSize s) { CGFloat scale = YGScaleFactor(); return (CGSize) { .width = ceil(s.width * scale) / scale, .height = ceil(s.height * scale) / scale }; @@ -553,7 +548,7 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { } view.frame = (CGRect) { - .origin = YGRoundPixelPosition(frame.origin), + .origin = frame.origin, .size = YGAlignPixelSize(frame.size) }; #else @@ -562,10 +557,10 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { .size = YGAlignPixelSize(frame.size) }; - view.center = YGRoundPixelPosition((CGPoint) { - .x = CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5, - .y = CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5 - }); + view.center = (CGPoint) { + .x = CGRectGetMidX(frame), + .y = CGRectGetMidY(frame) + }; #endif if (!yoga.isLeaf) { diff --git a/YogaKit/Tests/YogaKitTests.m b/YogaKit/Tests/YogaKitTests.m index 29b02be6..11724826 100644 --- a/YogaKit/Tests/YogaKitTests.m +++ b/YogaKit/Tests/YogaKitTests.m @@ -265,16 +265,28 @@ subview1.yoga.flexGrow = 1; [container addSubview:subview1]; + UIView *leafView = [[UIView alloc] init]; + leafView.yoga.isEnabled = YES; + [subview1 addSubview:leafView]; + UIView* subview2 = [[UIView alloc] initWithFrame:CGRectZero]; subview2.yoga.isEnabled = YES; subview2.yoga.flexGrow = 1; [container addSubview:subview2]; + leafView = [[UIView alloc] init]; + leafView.yoga.isEnabled = YES; + [subview2 addSubview:leafView]; + UIView* subview3 = [[UIView alloc] initWithFrame:CGRectZero]; subview3.yoga.isEnabled = YES; subview3.yoga.flexGrow = 1; [container addSubview:subview3]; + leafView = [[UIView alloc] init]; + leafView.yoga.isEnabled = YES; + [subview3 addSubview:leafView]; + [container.yoga applyLayoutPreservingOrigin:YES]; XCTAssertEqualWithAccuracy( diff --git a/yoga/Utils.cpp b/yoga/Utils.cpp index edb198d2..f9c1dc6b 100644 --- a/yoga/Utils.cpp +++ b/yoga/Utils.cpp @@ -18,16 +18,16 @@ YGFlexDirection YGFlexDirectionCross( : YGFlexDirectionColumn; } -float YGFloatMax(const float a, const float b) { +YGFloat YGFloatMax(const YGFloat a, const YGFloat b) { if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { - return fmaxf(a, b); + return fmax(a, b); } return yoga::isUndefined(a) ? b : a; } -float YGFloatMin(const float a, const float b) { +YGFloat YGFloatMin(const YGFloat a, const YGFloat b) { if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { - return fminf(a, b); + return fmin(a, b); } return yoga::isUndefined(a) ? b : a; @@ -46,7 +46,7 @@ bool YGValueEqual(const YGValue& a, const YGValue& b) { return fabs(a.value - b.value) < 0.0001f; } -bool YGFloatsEqual(const float a, const float b) { +bool YGFloatsEqual(const YGFloat a, const YGFloat b) { if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { return fabs(a - b) < 0.0001f; } @@ -60,7 +60,7 @@ bool YGDoubleEqual(const double a, const double b) { return yoga::isUndefined(a) && yoga::isUndefined(b); } -float YGFloatSanitize(const float val) { +YGFloat YGFloatSanitize(const YGFloat val) { return yoga::isUndefined(val) ? 0 : val; } diff --git a/yoga/Utils.h b/yoga/Utils.h index 57e1d45d..3cc4f181 100644 --- a/yoga/Utils.h +++ b/yoga/Utils.h @@ -38,19 +38,19 @@ struct YGCollectFlexItemsRowValues { uint32_t itemsOnLine; - float sizeConsumedOnCurrentLine; - float totalFlexGrowFactors; - float totalFlexShrinkScaledFactors; + YGFloat sizeConsumedOnCurrentLine; + YGFloat totalFlexGrowFactors; + YGFloat totalFlexShrinkScaledFactors; uint32_t endOfLineIndex; std::vector relativeChildren; - float remainingFreeSpace; + YGFloat remainingFreeSpace; // The size of the mainDim for the row after considering size, padding, margin // and border of flex items. This is used to calculate maxLineDim after going // through all the rows to decide on the main axis size of owner. - float mainDim; + YGFloat mainDim; // The size of the crossDim for the row after considering size, padding, // margin and border of flex items. Used for calculating containers crossSize. - float crossDim; + YGFloat crossDim; }; bool YGValueEqual(const YGValue& a, const YGValue& b); @@ -60,27 +60,27 @@ inline bool YGValueEqual( return YGValueEqual((YGValue) a, (YGValue) b); } -// This custom float equality function returns true if either absolute +// This custom YGFloat equality function returns true if either absolute // difference between two floats is less than 0.0001f or both are undefined. -bool YGFloatsEqual(const float a, const float b); +bool YGFloatsEqual(const YGFloat a, const YGFloat b); bool YGDoubleEqual(const double a, const double b); -float YGFloatMax(const float a, const float b); +YGFloat YGFloatMax(const YGFloat a, const YGFloat b); YGFloatOptional YGFloatOptionalMax( const YGFloatOptional op1, const YGFloatOptional op2); -float YGFloatMin(const float a, const float b); +YGFloat YGFloatMin(const YGFloat a, const YGFloat b); -// This custom float comparison function compares the array of float with -// YGFloatsEqual, as the default float comparison operator will not work(Look +// This custom YGFloat comparison function compares the array of YGFloat with +// YGFloatsEqual, as the default YGFloat comparison operator will not work(Look // at the comments of YGFloatsEqual function). template bool YGFloatArrayEqual( - const std::array& val1, - const std::array& val2) { + const std::array& val1, + const std::array& val2) { bool areEqual = true; for (std::size_t i = 0; i < size && areEqual; ++i) { areEqual = YGFloatsEqual(val1[i], val2[i]); @@ -89,7 +89,7 @@ bool YGFloatArrayEqual( } // This function returns 0 if YGFloatIsUndefined(val) is true and val otherwise -float YGFloatSanitize(const float val); +YGFloat YGFloatSanitize(const YGFloat val); YGFlexDirection YGFlexDirectionCross( const YGFlexDirection flexDirection, @@ -102,7 +102,7 @@ inline bool YGFlexDirectionIsRow(const YGFlexDirection flexDirection) { inline YGFloatOptional YGResolveValue( const YGValue value, - const float ownerSize) { + const YGFloat ownerSize) { switch (value.unit) { case YGUnitPoint: return YGFloatOptional{value.value}; @@ -115,7 +115,7 @@ inline YGFloatOptional YGResolveValue( inline YGFloatOptional YGResolveValue( yoga::detail::CompactValue value, - float ownerSize) { + YGFloat ownerSize) { return YGResolveValue((YGValue) value, ownerSize); } @@ -140,7 +140,7 @@ inline YGFlexDirection YGResolveFlexDirection( inline YGFloatOptional YGResolveValueMargin( yoga::detail::CompactValue value, - const float ownerSize) { + const YGFloat ownerSize) { return value.isAuto() ? YGFloatOptional{0} : YGResolveValue(value, ownerSize); } diff --git a/yoga/YGConfig.h b/yoga/YGConfig.h index e87d6758..1154a002 100644 --- a/yoga/YGConfig.h +++ b/yoga/YGConfig.h @@ -40,7 +40,7 @@ public: bool useLegacyStretchBehaviour = false; bool shouldDiffLayoutWithoutLegacyStretchBehaviour = false; bool printTree = false; - float pointScaleFactor = 1.0f; + YGFloat pointScaleFactor = 1.0f; std::array()> experimentalFeatures = {}; void* context = nullptr; diff --git a/yoga/YGFloatOptional.h b/yoga/YGFloatOptional.h index e4cf0284..f7dfed5a 100644 --- a/yoga/YGFloatOptional.h +++ b/yoga/YGFloatOptional.h @@ -13,14 +13,14 @@ struct YGFloatOptional { private: - float value_ = std::numeric_limits::quiet_NaN(); + YGFloat value_ = std::numeric_limits::quiet_NaN(); public: - explicit constexpr YGFloatOptional(float value) : value_(value) {} + explicit constexpr YGFloatOptional(YGFloat value) : value_(value) {} constexpr YGFloatOptional() = default; // returns the wrapped value, or a value x with YGIsUndefined(x) == true - constexpr float unwrap() const { return value_; } + constexpr YGFloat unwrap() const { return value_; } bool isUndefined() const { return std::isnan(value_); } }; @@ -35,17 +35,17 @@ inline bool operator!=(YGFloatOptional lhs, YGFloatOptional rhs) { return !(lhs == rhs); } -inline bool operator==(YGFloatOptional lhs, float rhs) { +inline bool operator==(YGFloatOptional lhs, YGFloat rhs) { return lhs == YGFloatOptional{rhs}; } -inline bool operator!=(YGFloatOptional lhs, float rhs) { +inline bool operator!=(YGFloatOptional lhs, YGFloat rhs) { return !(lhs == rhs); } -inline bool operator==(float lhs, YGFloatOptional rhs) { +inline bool operator==(YGFloat lhs, YGFloatOptional rhs) { return rhs == lhs; } -inline bool operator!=(float lhs, YGFloatOptional rhs) { +inline bool operator!=(YGFloat lhs, YGFloatOptional rhs) { return !(lhs == rhs); } diff --git a/yoga/YGLayout.h b/yoga/YGLayout.h index b7604d8e..1311cf3a 100644 --- a/yoga/YGLayout.h +++ b/yoga/YGLayout.h @@ -13,11 +13,11 @@ using namespace facebook::yoga; struct YGLayout { - std::array position = {}; - std::array dimensions = {{YGUndefined, YGUndefined}}; - std::array margin = {}; - std::array border = {}; - std::array padding = {}; + std::array position = {}; + std::array dimensions = {{YGUndefined, YGUndefined}}; + std::array margin = {}; + std::array border = {}; + std::array padding = {}; private: static constexpr size_t directionOffset = 0; @@ -41,7 +41,7 @@ public: uint32_t nextCachedMeasurementsIndex = 0; std::array cachedMeasurements = {}; - std::array measuredDimensions = {{YGUndefined, YGUndefined}}; + std::array measuredDimensions = {{YGUndefined, YGUndefined}}; YGCachedMeasurement cachedLayout = YGCachedMeasurement(); diff --git a/yoga/YGMacros.h b/yoga/YGMacros.h index 7c102ab4..81ce8142 100644 --- a/yoga/YGMacros.h +++ b/yoga/YGMacros.h @@ -7,6 +7,21 @@ #pragma once +#if defined(__LP64__) && __LP64__ +# define YGFLOAT_TYPE double +# define YGFLOAT_IS_DOUBLE 1 +# define YGFLOAT_MIN DBL_MIN +# define YGFLOAT_MAX DBL_MAX +#else +# define YGFLOAT_TYPE float +# define YGFLOAT_IS_DOUBLE 0 +# define YGFLOAT_MIN FLT_MIN +# define YGFLOAT_MAX FLT_MAX +#endif + +typedef YGFLOAT_TYPE YGFloat; +#define YGFLOAT_DEFINED 1 + #ifdef __cplusplus #define YG_EXTERN_CXX_BEGIN extern "C++" { #define YG_EXTERN_C_BEGIN extern "C" { diff --git a/yoga/YGNode.cpp b/yoga/YGNode.cpp index 1ee1bde6..b4fa4947 100644 --- a/yoga/YGNode.cpp +++ b/yoga/YGNode.cpp @@ -52,7 +52,7 @@ void YGNode::print(void* printContext) { YGFloatOptional YGNode::getLeadingPosition( const YGFlexDirection axis, - const float axisSize) const { + const YGFloat axisSize) const { if (YGFlexDirectionIsRow(axis)) { auto leadingPosition = YGComputedEdgeValue( style_.position(), YGEdgeStart, CompactValue::ofUndefined()); @@ -71,7 +71,7 @@ YGFloatOptional YGNode::getLeadingPosition( YGFloatOptional YGNode::getTrailingPosition( const YGFlexDirection axis, - const float axisSize) const { + const YGFloat axisSize) const { if (YGFlexDirectionIsRow(axis)) { auto trailingPosition = YGComputedEdgeValue( style_.position(), YGEdgeEnd, CompactValue::ofUndefined()); @@ -110,7 +110,7 @@ bool YGNode::isTrailingPosDefined(const YGFlexDirection axis) const { YGFloatOptional YGNode::getLeadingMargin( const YGFlexDirection axis, - const float widthSize) const { + const YGFloat widthSize) const { if (YGFlexDirectionIsRow(axis) && !style_.margin()[YGEdgeStart].isUndefined()) { return YGResolveValueMargin(style_.margin()[YGEdgeStart], widthSize); @@ -124,7 +124,7 @@ YGFloatOptional YGNode::getLeadingMargin( YGFloatOptional YGNode::getTrailingMargin( const YGFlexDirection axis, - const float widthSize) const { + const YGFloat widthSize) const { if (YGFlexDirectionIsRow(axis) && !style_.margin()[YGEdgeEnd].isUndefined()) { return YGResolveValueMargin(style_.margin()[YGEdgeEnd], widthSize); } @@ -137,14 +137,14 @@ YGFloatOptional YGNode::getTrailingMargin( YGFloatOptional YGNode::getMarginForAxis( const YGFlexDirection axis, - const float widthSize) const { + const YGFloat widthSize) const { return getLeadingMargin(axis, widthSize) + getTrailingMargin(axis, widthSize); } YGSize YGNode::measure( - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode, void* layoutContext) { @@ -154,7 +154,7 @@ YGSize YGNode::measure( : measure_.noContext(this, width, widthMode, height, heightMode); } -float YGNode::baseline(float width, float height, void* layoutContext) { +YGFloat YGNode::baseline(YGFloat width, YGFloat height, void* layoutContext) { return facebook::yoga::detail::getBooleanData(flags, baselineUsesContext_) ? baseline_.withContext(this, width, height, layoutContext) : baseline_.noContext(this, width, height); @@ -235,15 +235,15 @@ void YGNode::setLayoutDirection(YGDirection direction) { layout_.setDirection(direction); } -void YGNode::setLayoutMargin(float margin, int index) { +void YGNode::setLayoutMargin(YGFloat margin, int index) { layout_.margin[index] = margin; } -void YGNode::setLayoutBorder(float border, int index) { +void YGNode::setLayoutBorder(YGFloat border, int index) { layout_.border[index] = border; } -void YGNode::setLayoutPadding(float padding, int index) { +void YGNode::setLayoutPadding(YGFloat padding, int index) { layout_.padding[index] = padding; } @@ -256,7 +256,7 @@ void YGNode::setLayoutComputedFlexBasis( layout_.computedFlexBasis = computedFlexBasis; } -void YGNode::setLayoutPosition(float position, int index) { +void YGNode::setLayoutPosition(YGFloat position, int index) { layout_.position[index] = position; } @@ -265,7 +265,7 @@ void YGNode::setLayoutComputedFlexBasisGeneration( layout_.computedFlexBasisGeneration = computedFlexBasisGeneration; } -void YGNode::setLayoutMeasuredDimension(float measuredDimension, int index) { +void YGNode::setLayoutMeasuredDimension(YGFloat measuredDimension, int index) { layout_.measuredDimensions[index] = measuredDimension; } @@ -273,7 +273,7 @@ void YGNode::setLayoutHadOverflow(bool hadOverflow) { layout_.setHadOverflow(hadOverflow); } -void YGNode::setLayoutDimension(float dimension, int index) { +void YGNode::setLayoutDimension(YGFloat dimension, int index) { layout_.dimensions[index] = dimension; } @@ -281,7 +281,7 @@ void YGNode::setLayoutDimension(float dimension, int index) { // -right depending on which is defined. YGFloatOptional YGNode::relativePosition( const YGFlexDirection axis, - const float axisSize) const { + const YGFloat axisSize) const { if (isLeadingPositionDefined(axis)) { return getLeadingPosition(axis, axisSize); } @@ -295,9 +295,9 @@ YGFloatOptional YGNode::relativePosition( void YGNode::setPosition( const YGDirection direction, - const float mainSize, - const float crossSize, - const float ownerWidth) { + const YGFloat mainSize, + const YGFloat crossSize, + const YGFloat ownerWidth) { /* Root nodes should be always layouted as LTR, so we don't return negative * values. */ const YGDirection directionRespectingRoot = @@ -411,7 +411,7 @@ void YGNode::markDirtyAndPropogateDownwards() { }); } -float YGNode::resolveFlexGrow() const { +YGFloat YGNode::resolveFlexGrow() const { // Root nodes flexGrow should always be 0 if (owner_ == nullptr) { return 0.0; @@ -425,7 +425,7 @@ float YGNode::resolveFlexGrow() const { return kDefaultFlexGrow; } -float YGNode::resolveFlexShrink() const { +YGFloat YGNode::resolveFlexShrink() const { if (owner_ == nullptr) { return 0.0; } @@ -447,7 +447,7 @@ bool YGNode::isNodeFlexible() { (resolveFlexGrow() != 0 || resolveFlexShrink() != 0)); } -float YGNode::getLeadingBorder(const YGFlexDirection axis) const { +YGFloat YGNode::getLeadingBorder(const YGFlexDirection axis) const { YGValue leadingBorder; if (YGFlexDirectionIsRow(axis) && !style_.border()[YGEdgeStart].isUndefined()) { @@ -462,7 +462,7 @@ float YGNode::getLeadingBorder(const YGFlexDirection axis) const { return YGFloatMax(leadingBorder.value, 0.0f); } -float YGNode::getTrailingBorder(const YGFlexDirection flexDirection) const { +YGFloat YGNode::getTrailingBorder(const YGFlexDirection flexDirection) const { YGValue trailingBorder; if (YGFlexDirectionIsRow(flexDirection) && !style_.border()[YGEdgeEnd].isUndefined()) { @@ -479,7 +479,7 @@ float YGNode::getTrailingBorder(const YGFlexDirection flexDirection) const { YGFloatOptional YGNode::getLeadingPadding( const YGFlexDirection axis, - const float widthSize) const { + const YGFloat widthSize) const { const YGFloatOptional paddingEdgeStart = YGResolveValue(style_.padding()[YGEdgeStart], widthSize); if (YGFlexDirectionIsRow(axis) && @@ -497,7 +497,7 @@ YGFloatOptional YGNode::getLeadingPadding( YGFloatOptional YGNode::getTrailingPadding( const YGFlexDirection axis, - const float widthSize) const { + const YGFloat widthSize) const { const YGFloatOptional paddingEdgeEnd = YGResolveValue(style_.padding()[YGEdgeEnd], widthSize); if (YGFlexDirectionIsRow(axis) && paddingEdgeEnd >= YGFloatOptional{0.0f}) { @@ -514,14 +514,14 @@ YGFloatOptional YGNode::getTrailingPadding( YGFloatOptional YGNode::getLeadingPaddingAndBorder( const YGFlexDirection axis, - const float widthSize) const { + const YGFloat widthSize) const { return getLeadingPadding(axis, widthSize) + YGFloatOptional(getLeadingBorder(axis)); } YGFloatOptional YGNode::getTrailingPaddingAndBorder( const YGFlexDirection axis, - const float widthSize) const { + const YGFloat widthSize) const { return getTrailingPadding(axis, widthSize) + YGFloatOptional(getTrailingBorder(axis)); } diff --git a/yoga/YGNode.h b/yoga/YGNode.h index 63d98fe3..b2fb9347 100644 --- a/yoga/YGNode.h +++ b/yoga/YGNode.h @@ -23,8 +23,8 @@ YGConfigRef YGConfigGetDefault(); struct YOGA_EXPORT YGNode { using MeasureWithContextFn = - YGSize (*)(YGNode*, float, YGMeasureMode, float, YGMeasureMode, void*); - using BaselineWithContextFn = float (*)(YGNode*, float, float, void*); + YGSize (*)(YGNode*, YGFloat, YGMeasureMode, YGFloat, YGMeasureMode, void*); + using BaselineWithContextFn = YGFloat (*)(YGNode*, YGFloat, YGFloat, void*); using PrintWithContextFn = void (*)(YGNode*, void*); private: @@ -64,7 +64,7 @@ private: YGFloatOptional relativePosition( const YGFlexDirection axis, - const float axisSize) const; + const YGFloat axisSize) const; void setMeasureFunc(decltype(measure_)); void setBaselineFunc(decltype(baseline_)); @@ -124,13 +124,13 @@ public: bool hasMeasureFunc() const noexcept { return measure_.noContext != nullptr; } - YGSize measure(float, YGMeasureMode, float, YGMeasureMode, void*); + YGSize measure(YGFloat, YGMeasureMode, YGFloat, YGMeasureMode, void*); bool hasBaselineFunc() const noexcept { return baseline_.noContext != nullptr; } - float baseline(float width, float height, void* layoutContext); + YGFloat baseline(YGFloat width, YGFloat height, void* layoutContext); YGDirtiedFunc getDirtied() const { return dirtied_; } @@ -196,35 +196,35 @@ public: // Methods related to positions, margin, padding and border YGFloatOptional getLeadingPosition( const YGFlexDirection axis, - const float axisSize) const; + const YGFloat axisSize) const; bool isLeadingPositionDefined(const YGFlexDirection axis) const; bool isTrailingPosDefined(const YGFlexDirection axis) const; YGFloatOptional getTrailingPosition( const YGFlexDirection axis, - const float axisSize) const; + const YGFloat axisSize) const; YGFloatOptional getLeadingMargin( const YGFlexDirection axis, - const float widthSize) const; + const YGFloat widthSize) const; YGFloatOptional getTrailingMargin( const YGFlexDirection axis, - const float widthSize) const; - float getLeadingBorder(const YGFlexDirection flexDirection) const; - float getTrailingBorder(const YGFlexDirection flexDirection) const; + const YGFloat widthSize) const; + YGFloat getLeadingBorder(const YGFlexDirection flexDirection) const; + YGFloat getTrailingBorder(const YGFlexDirection flexDirection) const; YGFloatOptional getLeadingPadding( const YGFlexDirection axis, - const float widthSize) const; + const YGFloat widthSize) const; YGFloatOptional getTrailingPadding( const YGFlexDirection axis, - const float widthSize) const; + const YGFloat widthSize) const; YGFloatOptional getLeadingPaddingAndBorder( const YGFlexDirection axis, - const float widthSize) const; + const YGFloat widthSize) const; YGFloatOptional getTrailingPaddingAndBorder( const YGFlexDirection axis, - const float widthSize) const; + const YGFloat widthSize) const; YGFloatOptional getMarginForAxis( const YGFlexDirection axis, - const float widthSize) const; + const YGFloat widthSize) const; // Setters void setContext(void* context) { context_ = context; } @@ -292,19 +292,19 @@ public: void setLayoutComputedFlexBasis(const YGFloatOptional computedFlexBasis); void setLayoutComputedFlexBasisGeneration( uint32_t computedFlexBasisGeneration); - void setLayoutMeasuredDimension(float measuredDimension, int index); + void setLayoutMeasuredDimension(YGFloat measuredDimension, int index); void setLayoutHadOverflow(bool hadOverflow); - void setLayoutDimension(float dimension, int index); + void setLayoutDimension(YGFloat dimension, int index); void setLayoutDirection(YGDirection direction); - void setLayoutMargin(float margin, int index); - void setLayoutBorder(float border, int index); - void setLayoutPadding(float padding, int index); - void setLayoutPosition(float position, int index); + void setLayoutMargin(YGFloat margin, int index); + void setLayoutBorder(YGFloat border, int index); + void setLayoutPadding(YGFloat padding, int index); + void setLayoutPosition(YGFloat position, int index); void setPosition( const YGDirection direction, - const float mainSize, - const float crossSize, - const float ownerWidth); + const YGFloat mainSize, + const YGFloat crossSize, + const YGFloat ownerWidth); void setLayoutDoesLegacyFlagAffectsLayout(bool doesLegacyFlagAffectsLayout); void setLayoutDidUseLegacyFlag(bool didUseLegacyFlag); void markDirtyAndPropogateDownwards(); @@ -326,8 +326,8 @@ public: void cloneChildrenIfNeeded(void*); void markDirtyAndPropogate(); - float resolveFlexGrow() const; - float resolveFlexShrink() const; + YGFloat resolveFlexGrow() const; + YGFloat resolveFlexShrink() const; bool isNodeFlexible(); bool didUseLegacyFlag(); bool isLayoutTreeEqualToNode(const YGNode& node) const; diff --git a/yoga/YGValue.h b/yoga/YGValue.h index 93865ac4..32659678 100644 --- a/yoga/YGValue.h +++ b/yoga/YGValue.h @@ -25,7 +25,7 @@ YG_EXTERN_C_BEGIN // Not defined in MSVC++ #ifndef NAN static const uint32_t __nan = 0x7fc00000; -#define NAN (*(const float*) __nan) +#define NAN (*(const YGFloat*) __nan) #endif #define YGUndefined NAN diff --git a/yoga/Yoga-internal.h b/yoga/Yoga-internal.h index 1a22f24c..067fa965 100644 --- a/yoga/Yoga-internal.h +++ b/yoga/Yoga-internal.h @@ -19,8 +19,8 @@ YG_EXTERN_C_BEGIN void YGNodeCalculateLayoutWithContext( YGNodeRef node, - float availableWidth, - float availableHeight, + YGFloat availableWidth, + YGFloat availableHeight, YGDirection ownerDirection, void* layoutContext); @@ -29,7 +29,7 @@ YG_EXTERN_C_END namespace facebook { namespace yoga { -inline bool isUndefined(float value) { +inline bool isUndefined(YGFloat value) { return std::isnan(value); } @@ -45,13 +45,13 @@ extern const YGValue YGValueAuto; extern const YGValue YGValueZero; struct YGCachedMeasurement { - float availableWidth; - float availableHeight; + YGFloat availableWidth; + YGFloat availableHeight; YGMeasureMode widthMeasureMode; YGMeasureMode heightMeasureMode; - float computedWidth; - float computedHeight; + YGFloat computedWidth; + YGFloat computedHeight; YGCachedMeasurement() : availableWidth(-1), @@ -139,11 +139,11 @@ public: } // namespace yoga } // namespace facebook -static const float kDefaultFlexGrow = 0.0f; -static const float kDefaultFlexShrink = 0.0f; -static const float kWebDefaultFlexShrink = 1.0f; +static const YGFloat kDefaultFlexGrow = 0.0f; +static const YGFloat kDefaultFlexShrink = 0.0f; +static const YGFloat kWebDefaultFlexShrink = 1.0f; -extern bool YGFloatsEqual(const float a, const float b); +extern bool YGFloatsEqual(const YGFloat a, const YGFloat b); extern facebook::yoga::detail::CompactValue YGComputedEdgeValue( const facebook::yoga::detail::Values< facebook::yoga::enums::count()>& edges, diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 97e64075..21cc1e57 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -22,7 +22,7 @@ /* define fmaxf if < VC12 */ #if _MSC_VER < 1800 -__forceinline const float fmaxf(const float a, const float b) { +__forceinline const YGFloat fmax(const YGFloat a, const YGFloat b) { return (a > b) ? a : b; } #endif @@ -106,7 +106,7 @@ static int YGDefaultLog( #undef YG_UNUSED #endif -YOGA_EXPORT bool YGFloatIsUndefined(const float value) { +YOGA_EXPORT bool YGFloatIsUndefined(const YGFloat value) { return facebook::yoga::isUndefined(value); } @@ -525,13 +525,13 @@ YOGA_EXPORT void YGNodeCopyStyle( } } -YOGA_EXPORT float YGNodeStyleGetFlexGrow(const YGNodeConstRef node) { +YOGA_EXPORT YGFloat YGNodeStyleGetFlexGrow(const YGNodeConstRef node) { return node->getStyle().flexGrow().isUndefined() ? kDefaultFlexGrow : node->getStyle().flexGrow().unwrap(); } -YOGA_EXPORT float YGNodeStyleGetFlexShrink(const YGNodeConstRef node) { +YOGA_EXPORT YGFloat YGNodeStyleGetFlexShrink(const YGNodeConstRef node) { return node->getStyle().flexShrink().isUndefined() ? (node->getConfig()->useWebDefaults ? kWebDefaultFlexShrink : kDefaultFlexShrink) @@ -681,12 +681,12 @@ YOGA_EXPORT YGDisplay YGNodeStyleGetDisplay(const YGNodeConstRef node) { } // TODO(T26792433): Change the API to accept YGFloatOptional. -YOGA_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) { +YOGA_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const YGFloat flex) { updateStyle(node, &YGStyle::flex, YGFloatOptional{flex}); } // TODO(T26792433): Change the API to accept YGFloatOptional. -YOGA_EXPORT float YGNodeStyleGetFlex(const YGNodeConstRef node) { +YOGA_EXPORT YGFloat YGNodeStyleGetFlex(const YGNodeConstRef node) { return node->getStyle().flex().isUndefined() ? YGUndefined : node->getStyle().flex().unwrap(); @@ -695,7 +695,7 @@ YOGA_EXPORT float YGNodeStyleGetFlex(const YGNodeConstRef node) { // TODO(T26792433): Change the API to accept YGFloatOptional. YOGA_EXPORT void YGNodeStyleSetFlexGrow( const YGNodeRef node, - const float flexGrow) { + const YGFloat flexGrow) { updateStyle( node, &YGStyle::flexGrow, YGFloatOptional{flexGrow}); } @@ -703,7 +703,7 @@ YOGA_EXPORT void YGNodeStyleSetFlexGrow( // TODO(T26792433): Change the API to accept YGFloatOptional. YOGA_EXPORT void YGNodeStyleSetFlexShrink( const YGNodeRef node, - const float flexShrink) { + const YGFloat flexShrink) { updateStyle( node, &YGStyle::flexShrink, YGFloatOptional{flexShrink}); } @@ -719,14 +719,14 @@ YOGA_EXPORT YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetFlexBasis( const YGNodeRef node, - const float flexBasis) { + const YGFloat flexBasis) { auto value = detail::CompactValue::ofMaybe(flexBasis); updateStyle(node, &YGStyle::flexBasis, value); } YOGA_EXPORT void YGNodeStyleSetFlexBasisPercent( const YGNodeRef node, - const float flexBasisPercent) { + const YGFloat flexBasisPercent) { auto value = detail::CompactValue::ofMaybe(flexBasisPercent); updateStyle(node, &YGStyle::flexBasis, value); } @@ -739,7 +739,7 @@ YOGA_EXPORT void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) { YOGA_EXPORT void YGNodeStyleSetPosition( YGNodeRef node, YGEdge edge, - float points) { + YGFloat points) { auto value = detail::CompactValue::ofMaybe(points); updateIndexedStyleProp( node, &YGStyle::position, edge, value); @@ -747,7 +747,7 @@ YOGA_EXPORT void YGNodeStyleSetPosition( YOGA_EXPORT void YGNodeStyleSetPositionPercent( YGNodeRef node, YGEdge edge, - float percent) { + YGFloat percent) { auto value = detail::CompactValue::ofMaybe(percent); updateIndexedStyleProp( node, &YGStyle::position, edge, value); @@ -759,7 +759,7 @@ YOGA_EXPORT YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge) { YOGA_EXPORT void YGNodeStyleSetMargin( YGNodeRef node, YGEdge edge, - float points) { + YGFloat points) { auto value = detail::CompactValue::ofMaybe(points); updateIndexedStyleProp( node, &YGStyle::margin, edge, value); @@ -767,7 +767,7 @@ YOGA_EXPORT void YGNodeStyleSetMargin( YOGA_EXPORT void YGNodeStyleSetMarginPercent( YGNodeRef node, YGEdge edge, - float percent) { + YGFloat percent) { auto value = detail::CompactValue::ofMaybe(percent); updateIndexedStyleProp( node, &YGStyle::margin, edge, value); @@ -783,7 +783,7 @@ YOGA_EXPORT YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge) { YOGA_EXPORT void YGNodeStyleSetPadding( YGNodeRef node, YGEdge edge, - float points) { + YGFloat points) { auto value = detail::CompactValue::ofMaybe(points); updateIndexedStyleProp( node, &YGStyle::padding, edge, value); @@ -791,7 +791,7 @@ YOGA_EXPORT void YGNodeStyleSetPadding( YOGA_EXPORT void YGNodeStyleSetPaddingPercent( YGNodeRef node, YGEdge edge, - float percent) { + YGFloat percent) { auto value = detail::CompactValue::ofMaybe(percent); updateIndexedStyleProp( node, &YGStyle::padding, edge, value); @@ -804,13 +804,13 @@ YOGA_EXPORT YGValue YGNodeStyleGetPadding(YGNodeConstRef node, YGEdge edge) { YOGA_EXPORT void YGNodeStyleSetBorder( const YGNodeRef node, const YGEdge edge, - const float border) { + const YGFloat border) { auto value = detail::CompactValue::ofMaybe(border); updateIndexedStyleProp( node, &YGStyle::border, edge, value); } -YOGA_EXPORT float YGNodeStyleGetBorder( +YOGA_EXPORT YGFloat YGNodeStyleGetBorder( const YGNodeConstRef node, const YGEdge edge) { auto border = node->getStyle().border()[edge]; @@ -826,7 +826,7 @@ YOGA_EXPORT float YGNodeStyleGetBorder( // Yoga specific properties, not compatible with flexbox specification // TODO(T26792433): Change the API to accept YGFloatOptional. -YOGA_EXPORT float YGNodeStyleGetAspectRatio(const YGNodeConstRef node) { +YOGA_EXPORT YGFloat YGNodeStyleGetAspectRatio(const YGNodeConstRef node) { const YGFloatOptional op = node->getStyle().aspectRatio(); return op.isUndefined() ? YGUndefined : op.unwrap(); } @@ -834,17 +834,17 @@ YOGA_EXPORT float YGNodeStyleGetAspectRatio(const YGNodeConstRef node) { // TODO(T26792433): Change the API to accept YGFloatOptional. YOGA_EXPORT void YGNodeStyleSetAspectRatio( const YGNodeRef node, - const float aspectRatio) { + const YGFloat aspectRatio) { updateStyle( node, &YGStyle::aspectRatio, YGFloatOptional{aspectRatio}); } -YOGA_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float points) { +YOGA_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, YGFloat points) { auto value = detail::CompactValue::ofMaybe(points); updateIndexedStyleProp( node, &YGStyle::dimensions, YGDimensionWidth, value); } -YOGA_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) { +YOGA_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, YGFloat percent) { auto value = detail::CompactValue::ofMaybe(percent); updateIndexedStyleProp( node, &YGStyle::dimensions, YGDimensionWidth, value); @@ -860,12 +860,12 @@ YOGA_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node) { return node->getStyle().dimensions()[YGDimensionWidth]; } -YOGA_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float points) { +YOGA_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, YGFloat points) { auto value = detail::CompactValue::ofMaybe(points); updateIndexedStyleProp( node, &YGStyle::dimensions, YGDimensionHeight, value); } -YOGA_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) { +YOGA_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, YGFloat percent) { auto value = detail::CompactValue::ofMaybe(percent); updateIndexedStyleProp( node, &YGStyle::dimensions, YGDimensionHeight, value); @@ -883,14 +883,14 @@ YOGA_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetMinWidth( const YGNodeRef node, - const float minWidth) { + const YGFloat minWidth) { auto value = detail::CompactValue::ofMaybe(minWidth); updateIndexedStyleProp( node, &YGStyle::minDimensions, YGDimensionWidth, value); } YOGA_EXPORT void YGNodeStyleSetMinWidthPercent( const YGNodeRef node, - const float minWidth) { + const YGFloat minWidth) { auto value = detail::CompactValue::ofMaybe(minWidth); updateIndexedStyleProp( node, &YGStyle::minDimensions, YGDimensionWidth, value); @@ -901,14 +901,14 @@ YOGA_EXPORT YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetMinHeight( const YGNodeRef node, - const float minHeight) { + const YGFloat minHeight) { auto value = detail::CompactValue::ofMaybe(minHeight); updateIndexedStyleProp( node, &YGStyle::minDimensions, YGDimensionHeight, value); } YOGA_EXPORT void YGNodeStyleSetMinHeightPercent( const YGNodeRef node, - const float minHeight) { + const YGFloat minHeight) { auto value = detail::CompactValue::ofMaybe(minHeight); updateIndexedStyleProp( node, &YGStyle::minDimensions, YGDimensionHeight, value); @@ -919,14 +919,14 @@ YOGA_EXPORT YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetMaxWidth( const YGNodeRef node, - const float maxWidth) { + const YGFloat maxWidth) { auto value = detail::CompactValue::ofMaybe(maxWidth); updateIndexedStyleProp( node, &YGStyle::maxDimensions, YGDimensionWidth, value); } YOGA_EXPORT void YGNodeStyleSetMaxWidthPercent( const YGNodeRef node, - const float maxWidth) { + const YGFloat maxWidth) { auto value = detail::CompactValue::ofMaybe(maxWidth); updateIndexedStyleProp( node, &YGStyle::maxDimensions, YGDimensionWidth, value); @@ -937,14 +937,14 @@ YOGA_EXPORT YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetMaxHeight( const YGNodeRef node, - const float maxHeight) { + const YGFloat maxHeight) { auto value = detail::CompactValue::ofMaybe(maxHeight); updateIndexedStyleProp( node, &YGStyle::maxDimensions, YGDimensionHeight, value); } YOGA_EXPORT void YGNodeStyleSetMaxHeightPercent( const YGNodeRef node, - const float maxHeight) { + const YGFloat maxHeight) { auto value = detail::CompactValue::ofMaybe(maxHeight); updateIndexedStyleProp( node, &YGStyle::maxDimensions, YGDimensionHeight, value); @@ -985,18 +985,18 @@ YOGA_EXPORT YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) { return node->getLayout().instanceName[edge]; \ } -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Left, position[YGEdgeLeft]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Top, position[YGEdgeTop]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Right, position[YGEdgeRight]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Bottom, position[YGEdgeBottom]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Width, dimensions[YGDimensionWidth]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Height, dimensions[YGDimensionHeight]); +YG_NODE_LAYOUT_PROPERTY_IMPL(YGFloat, Left, position[YGEdgeLeft]); +YG_NODE_LAYOUT_PROPERTY_IMPL(YGFloat, Top, position[YGEdgeTop]); +YG_NODE_LAYOUT_PROPERTY_IMPL(YGFloat, Right, position[YGEdgeRight]); +YG_NODE_LAYOUT_PROPERTY_IMPL(YGFloat, Bottom, position[YGEdgeBottom]); +YG_NODE_LAYOUT_PROPERTY_IMPL(YGFloat, Width, dimensions[YGDimensionWidth]); +YG_NODE_LAYOUT_PROPERTY_IMPL(YGFloat, Height, dimensions[YGDimensionHeight]); YG_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction()); YG_NODE_LAYOUT_PROPERTY_IMPL(bool, HadOverflow, hadOverflow()); -YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Margin, margin); -YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Border, border); -YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Padding, padding); +YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(YGFloat, Margin, margin); +YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(YGFloat, Border, border); +YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(YGFloat, Padding, padding); YOGA_EXPORT bool YGNodeLayoutGetDidLegacyStretchFlagAffectLayout( const YGNodeRef node) { @@ -1007,13 +1007,13 @@ std::atomic gCurrentGenerationCount(0); bool YGLayoutNodeInternal( const YGNodeRef node, - const float availableWidth, - const float availableHeight, + const YGFloat availableWidth, + const YGFloat availableHeight, const YGDirection ownerDirection, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight, + const YGFloat ownerWidth, + const YGFloat ownerHeight, const bool performLayout, const LayoutPassReason reason, const YGConfigRef config, @@ -1053,10 +1053,10 @@ static const std::array pos = {{ static const std::array dim = { {YGDimensionHeight, YGDimensionHeight, YGDimensionWidth, YGDimensionWidth}}; -static inline float YGNodePaddingAndBorderForAxis( +static inline YGFloat YGNodePaddingAndBorderForAxis( const YGNodeConstRef node, const YGFlexDirection axis, - const float widthSize) { + const YGFloat widthSize) { return (node->getLeadingPaddingAndBorder(axis, widthSize) + node->getTrailingPaddingAndBorder(axis, widthSize)) .unwrap(); @@ -1073,12 +1073,12 @@ static inline YGAlign YGNodeAlignItem(const YGNode* node, const YGNode* child) { return align; } -static float YGBaseline(const YGNodeRef node, void* layoutContext) { +static YGFloat YGBaseline(const YGNodeRef node, void* layoutContext) { if (node->hasBaselineFunc()) { Event::publish(node); - const float baseline = node->baseline( + const YGFloat baseline = node->baseline( node->getLayout().measuredDimensions[YGDimensionWidth], node->getLayout().measuredDimensions[YGDimensionHeight], layoutContext); @@ -1117,7 +1117,7 @@ static float YGBaseline(const YGNodeRef node, void* layoutContext) { return node->getLayout().measuredDimensions[YGDimensionHeight]; } - const float baseline = YGBaseline(baselineChild, layoutContext); + const YGFloat baseline = YGBaseline(baselineChild, layoutContext); return baseline + baselineChild->getLayout().position[YGEdgeTop]; } @@ -1140,10 +1140,10 @@ static bool YGIsBaselineLayout(const YGNodeRef node) { return false; } -static inline float YGNodeDimWithMargin( +static inline YGFloat YGNodeDimWithMargin( const YGNodeRef node, const YGFlexDirection axis, - const float widthSize) { + const YGFloat widthSize) { return node->getLayout().measuredDimensions[dim[axis]] + (node->getLeadingMargin(axis, widthSize) + node->getTrailingMargin(axis, widthSize)) @@ -1153,7 +1153,7 @@ static inline float YGNodeDimWithMargin( static inline bool YGNodeIsStyleDimDefined( const YGNodeRef node, const YGFlexDirection axis, - const float ownerSize) { + const YGFloat ownerSize) { bool isUndefined = YGFloatIsUndefined(node->getResolvedDimension(dim[axis]).value); return !( @@ -1170,7 +1170,7 @@ static inline bool YGNodeIsStyleDimDefined( static inline bool YGNodeIsLayoutDimDefined( const YGNodeRef node, const YGFlexDirection axis) { - const float value = node->getLayout().measuredDimensions[dim[axis]]; + const YGFloat value = node->getLayout().measuredDimensions[dim[axis]]; return !YGFloatIsUndefined(value) && value >= 0.0f; } @@ -1178,7 +1178,7 @@ static YGFloatOptional YGNodeBoundAxisWithinMinAndMax( const YGNodeConstRef node, const YGFlexDirection axis, const YGFloatOptional value, - const float axisSize) { + const YGFloat axisSize) { YGFloatOptional min; YGFloatOptional max; @@ -1207,12 +1207,12 @@ static YGFloatOptional YGNodeBoundAxisWithinMinAndMax( // Like YGNodeBoundAxisWithinMinAndMax but also ensures that the value doesn't // go below the padding and border amount. -static inline float YGNodeBoundAxis( +static inline YGFloat YGNodeBoundAxis( const YGNodeRef node, const YGFlexDirection axis, - const float value, - const float axisSize, - const float widthSize) { + const YGFloat value, + const YGFloat axisSize, + const YGFloat widthSize) { return YGFloatMax( YGNodeBoundAxisWithinMinAndMax( node, axis, YGFloatOptional{value}, axisSize) @@ -1224,7 +1224,7 @@ static void YGNodeSetChildTrailingPosition( const YGNodeRef node, const YGNodeRef child, const YGFlexDirection axis) { - const float size = child->getLayout().measuredDimensions[dim[axis]]; + const YGFloat size = child->getLayout().measuredDimensions[dim[axis]]; child->setLayoutPosition( node->getLayout().measuredDimensions[dim[axis]] - size - child->getLayout().position[pos[axis]], @@ -1234,10 +1234,10 @@ static void YGNodeSetChildTrailingPosition( static void YGConstrainMaxSizeForMode( const YGNodeConstRef node, const enum YGFlexDirection axis, - const float ownerAxisSize, - const float ownerWidth, + const YGFloat ownerAxisSize, + const YGFloat ownerWidth, YGMeasureMode* mode, - float* size) { + YGFloat* size) { const YGFloatOptional maxSize = YGResolveValue( node->getStyle().maxDimensions()[dim[axis]], ownerAxisSize) + @@ -1261,11 +1261,11 @@ static void YGConstrainMaxSizeForMode( static void YGNodeComputeFlexBasisForChild( const YGNodeRef node, const YGNodeRef child, - const float width, + const YGFloat width, const YGMeasureMode widthMode, - const float height, - const float ownerWidth, - const float ownerHeight, + const YGFloat height, + const YGFloat ownerWidth, + const YGFloat ownerHeight, const YGMeasureMode heightMode, const YGDirection direction, const YGConfigRef config, @@ -1276,11 +1276,11 @@ static void YGNodeComputeFlexBasisForChild( const YGFlexDirection mainAxis = YGResolveFlexDirection(node->getStyle().flexDirection(), direction); const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); - const float mainAxisSize = isMainAxisRow ? width : height; - const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; + const YGFloat mainAxisSize = isMainAxisRow ? width : height; + const YGFloat mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; - float childWidth; - float childHeight; + YGFloat childWidth; + YGFloat childHeight; YGMeasureMode childWidthMeasureMode; YGMeasureMode childHeightMeasureMode; @@ -1460,9 +1460,9 @@ static void YGNodeComputeFlexBasisForChild( static void YGNodeAbsoluteLayoutChild( const YGNodeRef node, const YGNodeRef child, - const float width, + const YGFloat width, const YGMeasureMode widthMode, - const float height, + const YGFloat height, const YGDirection direction, const YGConfigRef config, LayoutData& layoutMarkerData, @@ -1474,8 +1474,8 @@ static void YGNodeAbsoluteLayoutChild( const YGFlexDirection crossAxis = YGFlexDirectionCross(mainAxis, direction); const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); - float childWidth = YGUndefined; - float childHeight = YGUndefined; + YGFloat childWidth = YGUndefined; + YGFloat childHeight = YGUndefined; YGMeasureMode childWidthMeasureMode = YGMeasureModeUndefined; YGMeasureMode childHeightMeasureMode = YGMeasureModeUndefined; @@ -1660,12 +1660,12 @@ static void YGNodeAbsoluteLayoutChild( static void YGNodeWithMeasureFuncSetMeasuredDimensions( const YGNodeRef node, - float availableWidth, - float availableHeight, + YGFloat availableWidth, + YGFloat availableHeight, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight, + const YGFloat ownerWidth, + const YGFloat ownerHeight, LayoutData& layoutMarkerData, void* const layoutContext, const LayoutPassReason reason) { @@ -1681,20 +1681,20 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( availableHeight = YGUndefined; } - const float paddingAndBorderAxisRow = + const YGFloat paddingAndBorderAxisRow = YGNodePaddingAndBorderForAxis(node, YGFlexDirectionRow, ownerWidth); - const float paddingAndBorderAxisColumn = + const YGFloat paddingAndBorderAxisColumn = YGNodePaddingAndBorderForAxis(node, YGFlexDirectionColumn, ownerWidth); - const float marginAxisRow = + const YGFloat marginAxisRow = node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap(); - const float marginAxisColumn = + const YGFloat marginAxisColumn = node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap(); // We want to make sure we don't call measure with negative size - const float innerWidth = YGFloatIsUndefined(availableWidth) + const YGFloat innerWidth = YGFloatIsUndefined(availableWidth) ? availableWidth : YGFloatMax(0, availableWidth - marginAxisRow - paddingAndBorderAxisRow); - const float innerHeight = YGFloatIsUndefined(availableHeight) + const YGFloat innerHeight = YGFloatIsUndefined(availableHeight) ? availableHeight : YGFloatMax( 0, availableHeight - marginAxisColumn - paddingAndBorderAxisColumn); @@ -1774,19 +1774,19 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( // or the minimum size as indicated by the padding and border sizes. static void YGNodeEmptyContainerSetMeasuredDimensions( const YGNodeRef node, - const float availableWidth, - const float availableHeight, + const YGFloat availableWidth, + const YGFloat availableHeight, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight) { - const float paddingAndBorderAxisRow = + const YGFloat ownerWidth, + const YGFloat ownerHeight) { + const YGFloat paddingAndBorderAxisRow = YGNodePaddingAndBorderForAxis(node, YGFlexDirectionRow, ownerWidth); - const float paddingAndBorderAxisColumn = + const YGFloat paddingAndBorderAxisColumn = YGNodePaddingAndBorderForAxis(node, YGFlexDirectionColumn, ownerWidth); - const float marginAxisRow = + const YGFloat marginAxisRow = node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap(); - const float marginAxisColumn = + const YGFloat marginAxisColumn = node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap(); node->setLayoutMeasuredDimension( @@ -1816,12 +1816,12 @@ static void YGNodeEmptyContainerSetMeasuredDimensions( static bool YGNodeFixedSizeSetMeasuredDimensions( const YGNodeRef node, - const float availableWidth, - const float availableHeight, + const YGFloat availableWidth, + const YGFloat availableHeight, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight) { + const YGFloat ownerWidth, + const YGFloat ownerHeight) { if ((!YGFloatIsUndefined(availableWidth) && widthMeasureMode == YGMeasureModeAtMost && availableWidth <= 0.0f) || (!YGFloatIsUndefined(availableHeight) && @@ -1876,23 +1876,23 @@ static void YGZeroOutLayoutRecursivly( YGZeroOutLayoutRecursivly, layoutContext); } -static float YGNodeCalculateAvailableInnerDim( +static YGFloat YGNodeCalculateAvailableInnerDim( const YGNodeConstRef node, YGFlexDirection axis, - float availableDim, - float ownerDim, - float ownerDimForMarginPadding) { + YGFloat availableDim, + YGFloat ownerDim, + YGFloat ownerDimForMarginPadding) { YGFlexDirection direction = YGFlexDirectionIsRow(axis) ? YGFlexDirectionRow : YGFlexDirectionColumn; YGDimension dimension = YGFlexDirectionIsRow(axis) ? YGDimensionWidth : YGDimensionHeight; - const float margin = + const YGFloat margin = node->getMarginForAxis(direction, ownerDimForMarginPadding).unwrap(); - const float paddingAndBorder = + const YGFloat paddingAndBorder = YGNodePaddingAndBorderForAxis(node, direction, ownerDimForMarginPadding); - float availableInnerDim = availableDim - margin - paddingAndBorder; + YGFloat availableInnerDim = availableDim - margin - paddingAndBorder; // Max dimension overrides predefined dimension value; Min dimension in turn // overrides both of the above if (!YGFloatIsUndefined(availableInnerDim)) { @@ -1900,14 +1900,14 @@ static float YGNodeCalculateAvailableInnerDim( // constraints const YGFloatOptional minDimensionOptional = YGResolveValue(node->getStyle().minDimensions()[dimension], ownerDim); - const float minInnerDim = minDimensionOptional.isUndefined() + const YGFloat minInnerDim = minDimensionOptional.isUndefined() ? 0.0f : minDimensionOptional.unwrap() - paddingAndBorder; const YGFloatOptional maxDimensionOptional = YGResolveValue(node->getStyle().maxDimensions()[dimension], ownerDim); - const float maxInnerDim = maxDimensionOptional.isUndefined() + const YGFloat maxInnerDim = maxDimensionOptional.isUndefined() ? FLT_MAX : maxDimensionOptional.unwrap() - paddingAndBorder; availableInnerDim = @@ -1917,10 +1917,10 @@ static float YGNodeCalculateAvailableInnerDim( return availableInnerDim; } -static float YGNodeComputeFlexBasisForChildren( +static YGFloat YGNodeComputeFlexBasisForChildren( const YGNodeRef node, - const float availableInnerWidth, - const float availableInnerHeight, + const YGFloat availableInnerWidth, + const YGFloat availableInnerHeight, YGMeasureMode widthMeasureMode, YGMeasureMode heightMeasureMode, YGDirection direction, @@ -1931,7 +1931,7 @@ static float YGNodeComputeFlexBasisForChildren( void* const layoutContext, const uint32_t depth, const uint32_t generationCount) { - float totalOuterFlexBasis = 0.0f; + YGFloat totalOuterFlexBasis = 0.0f; YGNodeRef singleFlexChild = nullptr; const YGVector& children = node->getChildren(); YGMeasureMode measureModeMainDim = @@ -1967,10 +1967,10 @@ static float YGNodeComputeFlexBasisForChildren( if (performLayout) { // Set the initial position (relative to the owner). const YGDirection childDirection = child->resolveDirection(direction); - const float mainDim = YGFlexDirectionIsRow(mainAxis) + const YGFloat mainDim = YGFlexDirectionIsRow(mainAxis) ? availableInnerWidth : availableInnerHeight; - const float crossDim = YGFlexDirectionIsRow(mainAxis) + const YGFloat crossDim = YGFlexDirectionIsRow(mainAxis) ? availableInnerHeight : availableInnerWidth; child->setPosition( @@ -2017,15 +2017,15 @@ static float YGNodeComputeFlexBasisForChildren( static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( const YGNodeRef& node, const YGDirection ownerDirection, - const float mainAxisownerSize, - const float availableInnerWidth, - const float availableInnerMainDim, + const YGFloat mainAxisownerSize, + const YGFloat availableInnerWidth, + const YGFloat availableInnerMainDim, const uint32_t startOfLineIndex, const uint32_t lineCount) { YGCollectFlexItemsRowValues flexAlgoRowMeasurement = {}; flexAlgoRowMeasurement.relativeChildren.reserve(node->getChildren().size()); - float sizeConsumedOnCurrentLineIncludingMinConstraint = 0; + YGFloat sizeConsumedOnCurrentLineIncludingMinConstraint = 0; const YGFlexDirection mainAxis = YGResolveFlexDirection( node->getStyle().flexDirection(), node->resolveDirection(ownerDirection)); const bool isNodeFlexWrap = node->getStyle().flexWrap() != YGWrapNoWrap; @@ -2039,9 +2039,9 @@ static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( continue; } child->setLineIndex(lineCount); - const float childMarginMainAxis = + const YGFloat childMarginMainAxis = child->getMarginForAxis(mainAxis, availableInnerWidth).unwrap(); - const float flexBasisWithMinAndMaxConstraints = + const YGFloat flexBasisWithMinAndMaxConstraints = YGNodeBoundAxisWithinMinAndMax( child, mainAxis, @@ -2097,16 +2097,16 @@ static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( // of the flex items abide the min and max constraints. At the end of this // function the child nodes would have proper size. Prior using this function // please ensure that YGDistributeFreeSpaceFirstPass is called. -static float YGDistributeFreeSpaceSecondPass( +static YGFloat YGDistributeFreeSpaceSecondPass( YGCollectFlexItemsRowValues& collectedFlexItemsValues, const YGNodeRef node, const YGFlexDirection mainAxis, const YGFlexDirection crossAxis, - const float mainAxisownerSize, - const float availableInnerMainDim, - const float availableInnerCrossDim, - const float availableInnerWidth, - const float availableInnerHeight, + const YGFloat mainAxisownerSize, + const YGFloat availableInnerMainDim, + const YGFloat availableInnerCrossDim, + const YGFloat availableInnerWidth, + const YGFloat availableInnerHeight, const bool flexBasisOverflows, const YGMeasureMode measureModeCrossDim, const bool performLayout, @@ -2115,10 +2115,10 @@ static float YGDistributeFreeSpaceSecondPass( void* const layoutContext, const uint32_t depth, const uint32_t generationCount) { - float childFlexBasis = 0; - float flexShrinkScaledFactor = 0; - float flexGrowFactor = 0; - float deltaFreeSpace = 0; + YGFloat childFlexBasis = 0; + YGFloat flexShrinkScaledFactor = 0; + YGFloat flexGrowFactor = 0; + YGFloat deltaFreeSpace = 0; const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); const bool isNodeFlexWrap = node->getStyle().flexWrap() != YGWrapNoWrap; @@ -2129,7 +2129,7 @@ static float YGDistributeFreeSpaceSecondPass( currentRelativeChild->getLayout().computedFlexBasis, mainAxisownerSize) .unwrap(); - float updatedMainSize = childFlexBasis; + YGFloat updatedMainSize = childFlexBasis; if (!YGFloatIsUndefined(collectedFlexItemsValues.remainingFreeSpace) && collectedFlexItemsValues.remainingFreeSpace < 0) { @@ -2137,7 +2137,7 @@ static float YGDistributeFreeSpaceSecondPass( -currentRelativeChild->resolveFlexShrink() * childFlexBasis; // Is this child able to shrink? if (flexShrinkScaledFactor != 0) { - float childSize; + YGFloat childSize; if (!YGFloatIsUndefined( collectedFlexItemsValues.totalFlexShrinkScaledFactors) && @@ -2178,15 +2178,15 @@ static float YGDistributeFreeSpaceSecondPass( deltaFreeSpace += updatedMainSize - childFlexBasis; - const float marginMain = + const YGFloat marginMain = currentRelativeChild->getMarginForAxis(mainAxis, availableInnerWidth) .unwrap(); - const float marginCross = + const YGFloat marginCross = currentRelativeChild->getMarginForAxis(crossAxis, availableInnerWidth) .unwrap(); - float childCrossSize; - float childMainSize = updatedMainSize + marginMain; + YGFloat childCrossSize; + YGFloat childMainSize = updatedMainSize + marginMain; YGMeasureMode childCrossMeasureMode; YGMeasureMode childMainMeasureMode = YGMeasureModeExactly; @@ -2257,8 +2257,8 @@ static float YGDistributeFreeSpaceSecondPass( YGUnitAuto && currentRelativeChild->marginTrailingValue(crossAxis).unit != YGUnitAuto; - const float childWidth = isMainAxisRow ? childMainSize : childCrossSize; - const float childHeight = !isMainAxisRow ? childMainSize : childCrossSize; + const YGFloat childWidth = isMainAxisRow ? childMainSize : childCrossSize; + const YGFloat childHeight = !isMainAxisRow ? childMainSize : childCrossSize; const YGMeasureMode childWidthMeasureMode = isMainAxisRow ? childMainMeasureMode : childCrossMeasureMode; @@ -2298,17 +2298,17 @@ static float YGDistributeFreeSpaceSecondPass( static void YGDistributeFreeSpaceFirstPass( YGCollectFlexItemsRowValues& collectedFlexItemsValues, const YGFlexDirection mainAxis, - const float mainAxisownerSize, - const float availableInnerMainDim, - const float availableInnerWidth) { - float flexShrinkScaledFactor = 0; - float flexGrowFactor = 0; - float baseMainSize = 0; - float boundMainSize = 0; - float deltaFreeSpace = 0; + const YGFloat mainAxisownerSize, + const YGFloat availableInnerMainDim, + const YGFloat availableInnerWidth) { + YGFloat flexShrinkScaledFactor = 0; + YGFloat flexGrowFactor = 0; + YGFloat baseMainSize = 0; + YGFloat boundMainSize = 0; + YGFloat deltaFreeSpace = 0; for (auto currentRelativeChild : collectedFlexItemsValues.relativeChildren) { - float childFlexBasis = + YGFloat childFlexBasis = YGNodeBoundAxisWithinMinAndMax( currentRelativeChild, mainAxis, @@ -2406,11 +2406,11 @@ static void YGResolveFlexibleLength( YGCollectFlexItemsRowValues& collectedFlexItemsValues, const YGFlexDirection mainAxis, const YGFlexDirection crossAxis, - const float mainAxisownerSize, - const float availableInnerMainDim, - const float availableInnerCrossDim, - const float availableInnerWidth, - const float availableInnerHeight, + const YGFloat mainAxisownerSize, + const YGFloat availableInnerMainDim, + const YGFloat availableInnerCrossDim, + const YGFloat availableInnerWidth, + const YGFloat availableInnerHeight, const bool flexBasisOverflows, const YGMeasureMode measureModeCrossDim, const bool performLayout, @@ -2419,7 +2419,7 @@ static void YGResolveFlexibleLength( void* const layoutContext, const uint32_t depth, const uint32_t generationCount) { - const float originalFreeSpace = collectedFlexItemsValues.remainingFreeSpace; + const YGFloat originalFreeSpace = collectedFlexItemsValues.remainingFreeSpace; // First pass: detect the flex items whose min/max constraints trigger YGDistributeFreeSpaceFirstPass( collectedFlexItemsValues, @@ -2429,7 +2429,7 @@ static void YGResolveFlexibleLength( availableInnerWidth); // Second pass: resolve the sizes of the flexible items - const float distributedFreeSpace = YGDistributeFreeSpaceSecondPass( + const YGFloat distributedFreeSpace = YGDistributeFreeSpaceSecondPass( collectedFlexItemsValues, node, mainAxis, @@ -2460,17 +2460,17 @@ static void YGJustifyMainAxis( const YGFlexDirection crossAxis, const YGMeasureMode measureModeMainDim, const YGMeasureMode measureModeCrossDim, - const float mainAxisownerSize, - const float ownerWidth, - const float availableInnerMainDim, - const float availableInnerCrossDim, - const float availableInnerWidth, + const YGFloat mainAxisownerSize, + const YGFloat ownerWidth, + const YGFloat availableInnerMainDim, + const YGFloat availableInnerCrossDim, + const YGFloat availableInnerWidth, const bool performLayout, void* const layoutContext) { const auto& style = node->getStyle(); - const float leadingPaddingAndBorderMain = + const YGFloat leadingPaddingAndBorderMain = node->getLeadingPaddingAndBorder(mainAxis, ownerWidth).unwrap(); - const float trailingPaddingAndBorderMain = + const YGFloat trailingPaddingAndBorderMain = node->getTrailingPaddingAndBorder(mainAxis, ownerWidth).unwrap(); // If we are using "at most" rules in the main axis, make sure that // remainingFreeSpace is 0 when min main dimension is not given @@ -2486,12 +2486,12 @@ static void YGJustifyMainAxis( // `minAvailableMainDim` denotes minimum available space in which child // can be laid out, it will exclude space consumed by padding and border. - const float minAvailableMainDim = + const YGFloat minAvailableMainDim = YGResolveValue( style.minDimensions()[dim[mainAxis]], mainAxisownerSize) .unwrap() - leadingPaddingAndBorderMain - trailingPaddingAndBorderMain; - const float occupiedSpaceByChildNodes = + const YGFloat occupiedSpaceByChildNodes = availableInnerMainDim - collectedFlexItemsValues.remainingFreeSpace; collectedFlexItemsValues.remainingFreeSpace = YGFloatMax(0, minAvailableMainDim - occupiedSpaceByChildNodes); @@ -2518,8 +2518,8 @@ static void YGJustifyMainAxis( // In order to position the elements in the main axis, we have two controls. // The space between the beginning and the first element and the space between // each two elements. - float leadingMainDim = 0; - float betweenMainDim = 0; + YGFloat leadingMainDim = 0; + YGFloat betweenMainDim = 0; const YGJustify justifyContent = node->getStyle().justifyContent(); if (numberOfAutoMarginsOnCurrentLine == 0) { @@ -2560,8 +2560,8 @@ static void YGJustifyMainAxis( leadingPaddingAndBorderMain + leadingMainDim; collectedFlexItemsValues.crossDim = 0; - float maxAscentForCurrentLine = 0; - float maxDescentForCurrentLine = 0; + YGFloat maxAscentForCurrentLine = 0; + YGFloat maxDescentForCurrentLine = 0; bool isNodeBaselineLayout = YGIsBaselineLayout(node); for (uint32_t i = startOfLineIndex; i < collectedFlexItemsValues.endOfLineIndex; @@ -2627,12 +2627,12 @@ static void YGJustifyMainAxis( if (isNodeBaselineLayout) { // If the child is baseline aligned then the cross dimension is // calculated by adding maxAscent and maxDescent from the baseline. - const float ascent = YGBaseline(child, layoutContext) + + const YGFloat ascent = YGBaseline(child, layoutContext) + child ->getLeadingMargin( YGFlexDirectionColumn, availableInnerWidth) .unwrap(); - const float descent = + const YGFloat descent = child->getLayout().measuredDimensions[YGDimensionHeight] + child ->getMarginForAxis( @@ -2736,13 +2736,13 @@ static void YGJustifyMainAxis( // static void YGNodelayoutImpl( const YGNodeRef node, - const float availableWidth, - const float availableHeight, + const YGFloat availableWidth, + const YGFloat availableHeight, const YGDirection ownerDirection, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight, + const YGFloat ownerWidth, + const YGFloat ownerHeight, const bool performLayout, const YGConfigRef config, LayoutData& layoutMarkerData, @@ -2863,14 +2863,14 @@ static void YGNodelayoutImpl( const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); const bool isNodeFlexWrap = node->getStyle().flexWrap() != YGWrapNoWrap; - const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; - const float crossAxisownerSize = isMainAxisRow ? ownerHeight : ownerWidth; + const YGFloat mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; + const YGFloat crossAxisownerSize = isMainAxisRow ? ownerHeight : ownerWidth; - const float leadingPaddingAndBorderCross = + const YGFloat leadingPaddingAndBorderCross = node->getLeadingPaddingAndBorder(crossAxis, ownerWidth).unwrap(); - const float paddingAndBorderAxisMain = + const YGFloat paddingAndBorderAxisMain = YGNodePaddingAndBorderForAxis(node, mainAxis, ownerWidth); - const float paddingAndBorderAxisCross = + const YGFloat paddingAndBorderAxisCross = YGNodePaddingAndBorderForAxis(node, crossAxis, ownerWidth); YGMeasureMode measureModeMainDim = @@ -2878,49 +2878,49 @@ static void YGNodelayoutImpl( YGMeasureMode measureModeCrossDim = isMainAxisRow ? heightMeasureMode : widthMeasureMode; - const float paddingAndBorderAxisRow = + const YGFloat paddingAndBorderAxisRow = isMainAxisRow ? paddingAndBorderAxisMain : paddingAndBorderAxisCross; - const float paddingAndBorderAxisColumn = + const YGFloat paddingAndBorderAxisColumn = isMainAxisRow ? paddingAndBorderAxisCross : paddingAndBorderAxisMain; - const float marginAxisRow = + const YGFloat marginAxisRow = node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap(); - const float marginAxisColumn = + const YGFloat marginAxisColumn = node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap(); const auto& minDimensions = node->getStyle().minDimensions(); const auto& maxDimensions = node->getStyle().maxDimensions(); - const float minInnerWidth = + const YGFloat minInnerWidth = YGResolveValue(minDimensions[YGDimensionWidth], ownerWidth).unwrap() - paddingAndBorderAxisRow; - const float maxInnerWidth = + const YGFloat maxInnerWidth = YGResolveValue(maxDimensions[YGDimensionWidth], ownerWidth).unwrap() - paddingAndBorderAxisRow; - const float minInnerHeight = + const YGFloat minInnerHeight = YGResolveValue(minDimensions[YGDimensionHeight], ownerHeight).unwrap() - paddingAndBorderAxisColumn; - const float maxInnerHeight = + const YGFloat maxInnerHeight = YGResolveValue(maxDimensions[YGDimensionHeight], ownerHeight).unwrap() - paddingAndBorderAxisColumn; - const float minInnerMainDim = isMainAxisRow ? minInnerWidth : minInnerHeight; - const float maxInnerMainDim = isMainAxisRow ? maxInnerWidth : maxInnerHeight; + const YGFloat minInnerMainDim = isMainAxisRow ? minInnerWidth : minInnerHeight; + const YGFloat maxInnerMainDim = isMainAxisRow ? maxInnerWidth : maxInnerHeight; // STEP 2: DETERMINE AVAILABLE SIZE IN MAIN AND CROSS DIRECTIONS - float availableInnerWidth = YGNodeCalculateAvailableInnerDim( + YGFloat availableInnerWidth = YGNodeCalculateAvailableInnerDim( node, YGFlexDirectionRow, availableWidth, ownerWidth, ownerWidth); - float availableInnerHeight = YGNodeCalculateAvailableInnerDim( + YGFloat availableInnerHeight = YGNodeCalculateAvailableInnerDim( node, YGFlexDirectionColumn, availableHeight, ownerHeight, ownerWidth); - float availableInnerMainDim = + YGFloat availableInnerMainDim = isMainAxisRow ? availableInnerWidth : availableInnerHeight; - const float availableInnerCrossDim = + const YGFloat availableInnerCrossDim = isMainAxisRow ? availableInnerHeight : availableInnerWidth; // STEP 3: DETERMINE FLEX BASIS FOR EACH ITEM - float totalOuterFlexBasis = YGNodeComputeFlexBasisForChildren( + YGFloat totalOuterFlexBasis = YGNodeComputeFlexBasisForChildren( node, availableInnerWidth, availableInnerHeight, @@ -2952,10 +2952,10 @@ static void YGNodelayoutImpl( uint32_t lineCount = 0; // Accumulated cross dimensions of all lines so far. - float totalLineCrossDim = 0; + YGFloat totalLineCrossDim = 0; // Max main dimension of all the lines. - float maxLineMainDim = 0; + YGFloat maxLineMainDim = 0; YGCollectFlexItemsRowValues collectedFlexItemsValues; for (; endOfLineIndex < childCount; lineCount++, startOfLineIndex = endOfLineIndex) { @@ -3073,7 +3073,7 @@ static void YGNodelayoutImpl( performLayout, layoutContext); - float containerCrossAxis = availableInnerCrossDim; + YGFloat containerCrossAxis = availableInnerCrossDim; if (measureModeCrossDim == YGMeasureModeUndefined || measureModeCrossDim == YGMeasureModeAtMost) { // Compute the cross axis from the max cross dimension of the children. @@ -3136,7 +3136,7 @@ static void YGNodelayoutImpl( pos[crossAxis]); } } else { - float leadingCrossDim = leadingPaddingAndBorderCross; + YGFloat leadingCrossDim = leadingPaddingAndBorderCross; // For a relative children, we're either using alignItems (owner) or // alignSelf (child) in order to determine the position in the cross @@ -3153,10 +3153,10 @@ static void YGNodelayoutImpl( // no need to stretch. if (!YGNodeIsStyleDimDefined( child, crossAxis, availableInnerCrossDim)) { - float childMainSize = + YGFloat childMainSize = child->getLayout().measuredDimensions[dim[mainAxis]]; const auto& childStyle = child->getStyle(); - float childCrossSize = !childStyle.aspectRatio().isUndefined() + YGFloat childCrossSize = !childStyle.aspectRatio().isUndefined() ? child->getMarginForAxis(crossAxis, availableInnerWidth) .unwrap() + (isMainAxisRow @@ -3185,9 +3185,9 @@ static void YGNodelayoutImpl( &childCrossMeasureMode, &childCrossSize); - const float childWidth = + const YGFloat childWidth = isMainAxisRow ? childMainSize : childCrossSize; - const float childHeight = + const YGFloat childHeight = !isMainAxisRow ? childMainSize : childCrossSize; auto alignContent = node->getStyle().alignContent(); @@ -3222,7 +3222,7 @@ static void YGNodelayoutImpl( generationCount); } } else { - const float remainingCrossDim = containerCrossAxis - + const YGFloat remainingCrossDim = containerCrossAxis - YGNodeDimWithMargin(child, crossAxis, availableInnerWidth); if (child->marginLeadingValue(crossAxis).unit == YGUnitAuto && @@ -3259,10 +3259,10 @@ static void YGNodelayoutImpl( // STEP 8: MULTI-LINE CONTENT ALIGNMENT // currentLead stores the size of the cross dim if (performLayout && (isNodeFlexWrap || YGIsBaselineLayout(node))) { - float crossDimLead = 0; - float currentLead = leadingPaddingAndBorderCross; + YGFloat crossDimLead = 0; + YGFloat currentLead = leadingPaddingAndBorderCross; if (!YGFloatIsUndefined(availableInnerCrossDim)) { - const float remainingAlignContentDim = + const YGFloat remainingAlignContentDim = availableInnerCrossDim - totalLineCrossDim; switch (node->getStyle().alignContent()) { case YGAlignFlexEnd: @@ -3303,9 +3303,9 @@ static void YGNodelayoutImpl( uint32_t ii; // compute the line's height and find the endIndex - float lineHeight = 0; - float maxAscentForCurrentLine = 0; - float maxDescentForCurrentLine = 0; + YGFloat lineHeight = 0; + YGFloat maxAscentForCurrentLine = 0; + YGFloat maxDescentForCurrentLine = 0; for (ii = startIndex; ii < childCount; ii++) { const YGNodeRef child = node->getChild(ii); if (child->getStyle().display() == YGDisplayNone) { @@ -3323,12 +3323,12 @@ static void YGNodelayoutImpl( .unwrap()); } if (YGNodeAlignItem(node, child) == YGAlignBaseline) { - const float ascent = YGBaseline(child, layoutContext) + + const YGFloat ascent = YGBaseline(child, layoutContext) + child ->getLeadingMargin( YGFlexDirectionColumn, availableInnerWidth) .unwrap(); - const float descent = + const YGFloat descent = child->getLayout().measuredDimensions[YGDimensionHeight] + child ->getMarginForAxis( @@ -3373,7 +3373,7 @@ static void YGNodelayoutImpl( break; } case YGAlignCenter: { - float childHeight = + YGFloat childHeight = child->getLayout().measuredDimensions[dim[crossAxis]]; child->setLayoutPosition( @@ -3392,14 +3392,14 @@ static void YGNodelayoutImpl( // measured with the owners height yet. if (!YGNodeIsStyleDimDefined( child, crossAxis, availableInnerCrossDim)) { - const float childWidth = isMainAxisRow + const YGFloat childWidth = isMainAxisRow ? (child->getLayout() .measuredDimensions[YGDimensionWidth] + child->getMarginForAxis(mainAxis, availableInnerWidth) .unwrap()) : lineHeight; - const float childHeight = !isMainAxisRow + const YGFloat childHeight = !isMainAxisRow ? (child->getLayout() .measuredDimensions[YGDimensionHeight] + child->getMarginForAxis(crossAxis, availableInnerWidth) @@ -3631,17 +3631,17 @@ static const char* YGMeasureModeName( static inline bool YGMeasureModeSizeIsExactAndMatchesOldMeasuredSize( YGMeasureMode sizeMode, - float size, - float lastComputedSize) { + YGFloat size, + YGFloat lastComputedSize) { return sizeMode == YGMeasureModeExactly && YGFloatsEqual(size, lastComputedSize); } static inline bool YGMeasureModeOldSizeIsUnspecifiedAndStillFits( YGMeasureMode sizeMode, - float size, + YGFloat size, YGMeasureMode lastSizeMode, - float lastComputedSize) { + YGFloat lastComputedSize) { return sizeMode == YGMeasureModeAtMost && lastSizeMode == YGMeasureModeUndefined && (size >= lastComputedSize || YGFloatsEqual(size, lastComputedSize)); @@ -3649,10 +3649,10 @@ static inline bool YGMeasureModeOldSizeIsUnspecifiedAndStillFits( static inline bool YGMeasureModeNewMeasureSizeIsStricterAndStillValid( YGMeasureMode sizeMode, - float size, + YGFloat size, YGMeasureMode lastSizeMode, - float lastSize, - float lastComputedSize) { + YGFloat lastSize, + YGFloat lastComputedSize) { return lastSizeMode == YGMeasureModeAtMost && sizeMode == YGMeasureModeAtMost && !YGFloatIsUndefined(lastSize) && !YGFloatIsUndefined(size) && !YGFloatIsUndefined(lastComputedSize) && @@ -3660,7 +3660,7 @@ static inline bool YGMeasureModeNewMeasureSizeIsStricterAndStillValid( (lastComputedSize <= size || YGFloatsEqual(size, lastComputedSize)); } -YOGA_EXPORT float YGRoundValueToPixelGrid( +YOGA_EXPORT YGFloat YGRoundValueToPixelGrid( const double value, const double pointScaleFactor, const bool forceCeil, @@ -3681,8 +3681,8 @@ YOGA_EXPORT float YGRoundValueToPixelGrid( // negative number. For example, `fmodf(-2.2) = -0.2`. However, we want // `fractial` to be the number such that subtracting it from `value` will // give us `floor(value)`. In the case of negative numbers, adding 1 to - // `fmodf(value)` gives us this. Let's continue the example from above: - // - fractial = fmodf(-2.2) = -0.2 + // `fmod(value)` gives us this. Let's continue the example from above: + // - fractial = fmod(-2.2) = -0.2 // - Add 1 to the fraction: fractial2 = fractial + 1 = -0.2 + 1 = 0.8 // - Finding the `floor`: -2.2 - fractial2 = -2.2 - 0.8 = -3 ++fractial; @@ -3713,17 +3713,17 @@ YOGA_EXPORT float YGRoundValueToPixelGrid( YOGA_EXPORT bool YGNodeCanUseCachedMeasurement( const YGMeasureMode widthMode, - const float width, + const YGFloat width, const YGMeasureMode heightMode, - const float height, + const YGFloat height, const YGMeasureMode lastWidthMode, - const float lastWidth, + const YGFloat lastWidth, const YGMeasureMode lastHeightMode, - const float lastHeight, - const float lastComputedWidth, - const float lastComputedHeight, - const float marginRow, - const float marginColumn, + const YGFloat lastHeight, + const YGFloat lastComputedWidth, + const YGFloat lastComputedHeight, + const YGFloat marginRow, + const YGFloat marginColumn, const YGConfigRef config) { if ((!YGFloatIsUndefined(lastComputedHeight) && lastComputedHeight < 0) || (!YGFloatIsUndefined(lastComputedWidth) && lastComputedWidth < 0)) { @@ -3731,17 +3731,17 @@ YOGA_EXPORT bool YGNodeCanUseCachedMeasurement( } bool useRoundedComparison = config != nullptr && config->pointScaleFactor != 0; - const float effectiveWidth = useRoundedComparison + const YGFloat effectiveWidth = useRoundedComparison ? YGRoundValueToPixelGrid(width, config->pointScaleFactor, false, false) : width; - const float effectiveHeight = useRoundedComparison + const YGFloat effectiveHeight = useRoundedComparison ? YGRoundValueToPixelGrid(height, config->pointScaleFactor, false, false) : height; - const float effectiveLastWidth = useRoundedComparison + const YGFloat effectiveLastWidth = useRoundedComparison ? YGRoundValueToPixelGrid( lastWidth, config->pointScaleFactor, false, false) : lastWidth; - const float effectiveLastHeight = useRoundedComparison + const YGFloat effectiveLastHeight = useRoundedComparison ? YGRoundValueToPixelGrid( lastHeight, config->pointScaleFactor, false, false) : lastHeight; @@ -3793,13 +3793,13 @@ YOGA_EXPORT bool YGNodeCanUseCachedMeasurement( // bool YGLayoutNodeInternal( const YGNodeRef node, - const float availableWidth, - const float availableHeight, + const YGFloat availableWidth, + const YGFloat availableHeight, const YGDirection ownerDirection, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight, + const YGFloat ownerWidth, + const YGFloat ownerHeight, const bool performLayout, const LayoutPassReason reason, const YGConfigRef config, @@ -3837,9 +3837,9 @@ bool YGLayoutNodeInternal( // they are the most expensive to measure, so it's worth avoiding redundant // measurements if at all possible. if (node->hasMeasureFunc()) { - const float marginAxisRow = + const YGFloat marginAxisRow = node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap(); - const float marginAxisColumn = + const YGFloat marginAxisColumn = node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap(); // First, try to use the layout cache. @@ -4061,7 +4061,7 @@ bool YGLayoutNodeInternal( YOGA_EXPORT void YGConfigSetPointScaleFactor( const YGConfigRef config, - const float pixelsInPoint) { + const YGFloat pixelsInPoint) { YGAssertWithConfig( config, pixelsInPoint >= 0.0f, @@ -4158,8 +4158,8 @@ static void unsetUseLegacyFlagRecursively(YGNodeRef node) { YOGA_EXPORT void YGNodeCalculateLayoutWithContext( const YGNodeRef node, - const float ownerWidth, - const float ownerHeight, + const YGFloat ownerWidth, + const YGFloat ownerHeight, const YGDirection ownerDirection, void* layoutContext) { @@ -4171,7 +4171,7 @@ YOGA_EXPORT void YGNodeCalculateLayoutWithContext( // the input parameters don't change. gCurrentGenerationCount.fetch_add(1, std::memory_order_relaxed); node->resolveDimension(); - float width = YGUndefined; + YGFloat width = YGUndefined; YGMeasureMode widthMeasureMode = YGMeasureModeUndefined; const auto& maxDimensions = node->getStyle().maxDimensions(); if (YGNodeIsStyleDimDefined(node, YGFlexDirectionRow, ownerWidth)) { @@ -4192,7 +4192,7 @@ YOGA_EXPORT void YGNodeCalculateLayoutWithContext( : YGMeasureModeExactly; } - float height = YGUndefined; + YGFloat height = YGUndefined; YGMeasureMode heightMeasureMode = YGMeasureModeUndefined; if (YGNodeIsStyleDimDefined(node, YGFlexDirectionColumn, ownerHeight)) { height = (YGResolveValue( @@ -4310,8 +4310,8 @@ YOGA_EXPORT void YGNodeCalculateLayoutWithContext( YOGA_EXPORT void YGNodeCalculateLayout( const YGNodeRef node, - const float ownerWidth, - const float ownerHeight, + const YGFloat ownerWidth, + const YGFloat ownerHeight, const YGDirection ownerDirection) { YGNodeCalculateLayoutWithContext( node, ownerWidth, ownerHeight, ownerDirection, nullptr); diff --git a/yoga/Yoga.h b/yoga/Yoga.h index 36331622..c4d5cf8f 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -25,8 +25,8 @@ YG_EXTERN_C_BEGIN typedef struct YGSize { - float width; - float height; + YGFloat width; + YGFloat height; } YGSize; typedef struct YGConfig* YGConfigRef; @@ -36,11 +36,11 @@ typedef const struct YGNode* YGNodeConstRef; typedef YGSize (*YGMeasureFunc)( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode); -typedef float (*YGBaselineFunc)(YGNodeRef node, float width, float height); +typedef YGFloat (*YGBaselineFunc)(YGNodeRef node, YGFloat width, YGFloat height); typedef void (*YGDirtiedFunc)(YGNodeRef node); typedef void (*YGPrintFunc)(YGNodeRef node); typedef void (*YGNodeCleanupFunc)(YGNodeRef node); @@ -93,8 +93,8 @@ WIN_EXPORT bool YGNodeIsReferenceBaseline(YGNodeRef node); WIN_EXPORT void YGNodeCalculateLayout( YGNodeRef node, - float availableWidth, - float availableHeight, + YGFloat availableWidth, + YGFloat availableHeight, YGDirection ownerDirection); // Mark a node as dirty. Only valid for nodes with a custom measure function @@ -113,21 +113,21 @@ WIN_EXPORT void YGNodeMarkDirtyAndPropogateToDescendants(YGNodeRef node); WIN_EXPORT void YGNodePrint(YGNodeRef node, YGPrintOptions options); -WIN_EXPORT bool YGFloatIsUndefined(float value); +WIN_EXPORT bool YGFloatIsUndefined(YGFloat value); WIN_EXPORT bool YGNodeCanUseCachedMeasurement( YGMeasureMode widthMode, - float width, + YGFloat width, YGMeasureMode heightMode, - float height, + YGFloat height, YGMeasureMode lastWidthMode, - float lastWidth, + YGFloat lastWidth, YGMeasureMode lastHeightMode, - float lastHeight, - float lastComputedWidth, - float lastComputedHeight, - float marginRow, - float marginColumn, + YGFloat lastHeight, + YGFloat lastComputedWidth, + YGFloat lastComputedHeight, + YGFloat marginRow, + YGFloat marginColumn, YGConfigRef config); WIN_EXPORT void YGNodeCopyStyle(YGNodeRef dstNode, YGNodeRef srcNode); @@ -187,75 +187,75 @@ WIN_EXPORT YGOverflow YGNodeStyleGetOverflow(YGNodeConstRef node); WIN_EXPORT void YGNodeStyleSetDisplay(YGNodeRef node, YGDisplay display); WIN_EXPORT YGDisplay YGNodeStyleGetDisplay(YGNodeConstRef node); -WIN_EXPORT void YGNodeStyleSetFlex(YGNodeRef node, float flex); -WIN_EXPORT float YGNodeStyleGetFlex(YGNodeConstRef node); +WIN_EXPORT void YGNodeStyleSetFlex(YGNodeRef node, YGFloat flex); +WIN_EXPORT YGFloat YGNodeStyleGetFlex(YGNodeConstRef node); -WIN_EXPORT void YGNodeStyleSetFlexGrow(YGNodeRef node, float flexGrow); -WIN_EXPORT float YGNodeStyleGetFlexGrow(YGNodeConstRef node); +WIN_EXPORT void YGNodeStyleSetFlexGrow(YGNodeRef node, YGFloat flexGrow); +WIN_EXPORT YGFloat YGNodeStyleGetFlexGrow(YGNodeConstRef node); -WIN_EXPORT void YGNodeStyleSetFlexShrink(YGNodeRef node, float flexShrink); -WIN_EXPORT float YGNodeStyleGetFlexShrink(YGNodeConstRef node); +WIN_EXPORT void YGNodeStyleSetFlexShrink(YGNodeRef node, YGFloat flexShrink); +WIN_EXPORT YGFloat YGNodeStyleGetFlexShrink(YGNodeConstRef node); -WIN_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, float flexBasis); -WIN_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, float flexBasis); +WIN_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, YGFloat flexBasis); +WIN_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, YGFloat flexBasis); WIN_EXPORT void YGNodeStyleSetFlexBasisAuto(YGNodeRef node); WIN_EXPORT YGValue YGNodeStyleGetFlexBasis(YGNodeConstRef node); WIN_EXPORT void YGNodeStyleSetPosition( YGNodeRef node, YGEdge edge, - float position); + YGFloat position); WIN_EXPORT void YGNodeStyleSetPositionPercent( YGNodeRef node, YGEdge edge, - float position); + YGFloat position); WIN_EXPORT YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge); -WIN_EXPORT void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, float margin); +WIN_EXPORT void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, YGFloat margin); WIN_EXPORT void YGNodeStyleSetMarginPercent( YGNodeRef node, YGEdge edge, - float margin); + YGFloat margin); WIN_EXPORT void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge); WIN_EXPORT YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge); WIN_EXPORT void YGNodeStyleSetPadding( YGNodeRef node, YGEdge edge, - float padding); + YGFloat padding); WIN_EXPORT void YGNodeStyleSetPaddingPercent( YGNodeRef node, YGEdge edge, - float padding); + YGFloat padding); WIN_EXPORT YGValue YGNodeStyleGetPadding(YGNodeConstRef node, YGEdge edge); -WIN_EXPORT void YGNodeStyleSetBorder(YGNodeRef node, YGEdge edge, float border); -WIN_EXPORT float YGNodeStyleGetBorder(YGNodeConstRef node, YGEdge edge); +WIN_EXPORT void YGNodeStyleSetBorder(YGNodeRef node, YGEdge edge, YGFloat border); +WIN_EXPORT YGFloat YGNodeStyleGetBorder(YGNodeConstRef node, YGEdge edge); -WIN_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float width); -WIN_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float width); +WIN_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, YGFloat width); +WIN_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, YGFloat width); WIN_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node); WIN_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node); -WIN_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float height); -WIN_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float height); +WIN_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, YGFloat height); +WIN_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, YGFloat height); WIN_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node); WIN_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node); -WIN_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, float minWidth); -WIN_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, float minWidth); +WIN_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, YGFloat minWidth); +WIN_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, YGFloat minWidth); WIN_EXPORT YGValue YGNodeStyleGetMinWidth(YGNodeConstRef node); -WIN_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, float minHeight); -WIN_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, float minHeight); +WIN_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, YGFloat minHeight); +WIN_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, YGFloat minHeight); WIN_EXPORT YGValue YGNodeStyleGetMinHeight(YGNodeConstRef node); -WIN_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, float maxWidth); -WIN_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, float maxWidth); +WIN_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, YGFloat maxWidth); +WIN_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, YGFloat maxWidth); WIN_EXPORT YGValue YGNodeStyleGetMaxWidth(YGNodeConstRef node); -WIN_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, float maxHeight); -WIN_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, float maxHeight); +WIN_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, YGFloat maxHeight); +WIN_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, YGFloat maxHeight); WIN_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node); // Yoga specific properties, not compatible with flexbox specification Aspect @@ -273,15 +273,15 @@ WIN_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node); // - On a node with flex grow/shrink aspect ratio controls the size of the node // in the cross axis if unset // - Aspect ratio takes min/max dimensions into account -WIN_EXPORT void YGNodeStyleSetAspectRatio(YGNodeRef node, float aspectRatio); -WIN_EXPORT float YGNodeStyleGetAspectRatio(YGNodeConstRef node); +WIN_EXPORT void YGNodeStyleSetAspectRatio(YGNodeRef node, YGFloat aspectRatio); +WIN_EXPORT YGFloat YGNodeStyleGetAspectRatio(YGNodeConstRef node); -WIN_EXPORT float YGNodeLayoutGetLeft(YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetTop(YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetRight(YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetBottom(YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetWidth(YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetHeight(YGNodeRef node); +WIN_EXPORT YGFloat YGNodeLayoutGetLeft(YGNodeRef node); +WIN_EXPORT YGFloat YGNodeLayoutGetTop(YGNodeRef node); +WIN_EXPORT YGFloat YGNodeLayoutGetRight(YGNodeRef node); +WIN_EXPORT YGFloat YGNodeLayoutGetBottom(YGNodeRef node); +WIN_EXPORT YGFloat YGNodeLayoutGetWidth(YGNodeRef node); +WIN_EXPORT YGFloat YGNodeLayoutGetHeight(YGNodeRef node); WIN_EXPORT YGDirection YGNodeLayoutGetDirection(YGNodeRef node); WIN_EXPORT bool YGNodeLayoutGetHadOverflow(YGNodeRef node); bool YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(YGNodeRef node); @@ -290,9 +290,9 @@ bool YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(YGNodeRef node); // set using point values then the returned value will be the same as // YGNodeStyleGetXXX. However if they were set using a percentage value then the // returned value is the computed value used during layout. -WIN_EXPORT float YGNodeLayoutGetMargin(YGNodeRef node, YGEdge edge); -WIN_EXPORT float YGNodeLayoutGetBorder(YGNodeRef node, YGEdge edge); -WIN_EXPORT float YGNodeLayoutGetPadding(YGNodeRef node, YGEdge edge); +WIN_EXPORT YGFloat YGNodeLayoutGetMargin(YGNodeRef node, YGEdge edge); +WIN_EXPORT YGFloat YGNodeLayoutGetBorder(YGNodeRef node, YGEdge edge); +WIN_EXPORT YGFloat YGNodeLayoutGetPadding(YGNodeRef node, YGEdge edge); WIN_EXPORT void YGConfigSetLogger(YGConfigRef config, YGLogger logger); WIN_EXPORT void YGAssert(bool condition, const char* message); @@ -308,7 +308,7 @@ WIN_EXPORT void YGAssertWithConfig( // want to avoid rounding - set PointScaleFactor to 0 WIN_EXPORT void YGConfigSetPointScaleFactor( YGConfigRef config, - float pixelsInPoint); + YGFloat pixelsInPoint); void YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour( YGConfigRef config, bool shouldDiffLayout); @@ -351,7 +351,7 @@ WIN_EXPORT YGConfigRef YGConfigGetDefault(void); WIN_EXPORT void YGConfigSetContext(YGConfigRef config, void* context); WIN_EXPORT void* YGConfigGetContext(YGConfigRef config); -WIN_EXPORT float YGRoundValueToPixelGrid( +WIN_EXPORT YGFloat YGRoundValueToPixelGrid( double value, double pointScaleFactor, bool forceCeil, diff --git a/yoga/event/event.h b/yoga/event/event.h index 404ec376..c7ce6219 100644 --- a/yoga/event/event.h +++ b/yoga/event/event.h @@ -127,12 +127,12 @@ struct Event::TypedData { template <> struct Event::TypedData { void* layoutContext; - float width; + YGFloat width; YGMeasureMode widthMeasureMode; - float height; + YGFloat height; YGMeasureMode heightMeasureMode; - float measuredWidth; - float measuredHeight; + YGFloat measuredWidth; + YGFloat measuredHeight; const LayoutPassReason reason; }; -- 2.50.1.windows.1 From cc80a014886d20a127b4a2054afea7e9956c81a1 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Sat, 15 Aug 2020 15:42:48 +0800 Subject: [PATCH 33/38] [YogaKit] update YogaKitSample --- .../YogaKitSample.xcodeproj/project.pbxproj | 4 + .../AutoLayoutMixedViewController.swift | 74 +++++++++++++++++++ .../ExamplesViewController.swift | 3 +- 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 YogaKit/YogaKitSample/YogaKitSample/AutoLayoutMixedViewController.swift diff --git a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj index b379ab01..90b1f9c6 100644 --- a/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj +++ b/YogaKit/YogaKitSample/YogaKitSample.xcodeproj/project.pbxproj @@ -27,6 +27,7 @@ 15E1C34A24E568420086A4E6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C34924E568420086A4E6 /* main.m */; }; 15E1C34F24E56A8A0086A4E6 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15E1C34E24E56A8A0086A4E6 /* dummy.swift */; }; 15E1C35124E56AB60086A4E6 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 15E1C35024E56AB60086A4E6 /* libc++.tbd */; }; + 15F7301F24E7C097000108AD /* AutoLayoutMixedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15F7301E24E7C097000108AD /* AutoLayoutMixedViewController.swift */; }; 40BD9F461E477A09002790A9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F451E477A09002790A9 /* AppDelegate.swift */; }; 40BD9F4B1E47850C002790A9 /* BasicViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F4A1E47850C002790A9 /* BasicViewController.swift */; }; 40BD9F501E479079002790A9 /* SingleLabelCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40BD9F4F1E479079002790A9 /* SingleLabelCollectionCell.swift */; }; @@ -90,6 +91,7 @@ 15E1C34924E568420086A4E6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 15E1C34E24E56A8A0086A4E6 /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = ""; }; 15E1C35024E56AB60086A4E6 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS13.4.sdk/usr/lib/libc++.tbd"; sourceTree = DEVELOPER_DIR; }; + 15F7301E24E7C097000108AD /* AutoLayoutMixedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoLayoutMixedViewController.swift; sourceTree = ""; }; 1D2FF4D5FCA6A8C54A4074A3 /* Pods-YogaKitSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample.debug.xcconfig"; sourceTree = ""; }; 40BD9F451E477A09002790A9 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40BD9F4A1E47850C002790A9 /* BasicViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BasicViewController.swift; path = ViewControllers/BasicViewController.swift; sourceTree = ""; }; @@ -230,6 +232,7 @@ children = ( 40BD9F4A1E47850C002790A9 /* BasicViewController.swift */, 40BD9F511E479173002790A9 /* LayoutInclusionViewController.swift */, + 15F7301E24E7C097000108AD /* AutoLayoutMixedViewController.swift */, ); name = ViewControllers; sourceTree = ""; @@ -489,6 +492,7 @@ 638A94481E1F06D100A726AD /* ExamplesViewController.swift in Sources */, 40BD9F4B1E47850C002790A9 /* BasicViewController.swift in Sources */, 40BD9F461E477A09002790A9 /* AppDelegate.swift in Sources */, + 15F7301F24E7C097000108AD /* AutoLayoutMixedViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/YogaKit/YogaKitSample/YogaKitSample/AutoLayoutMixedViewController.swift b/YogaKit/YogaKitSample/YogaKitSample/AutoLayoutMixedViewController.swift new file mode 100644 index 00000000..e7a40fb8 --- /dev/null +++ b/YogaKit/YogaKitSample/YogaKitSample/AutoLayoutMixedViewController.swift @@ -0,0 +1,74 @@ +// +// AutoLayoutMixedViewController.swift +// YogaKitSample +// +// Created by lvv on 2020/8/15. +// Copyright © 2020 facebook. All rights reserved. +// + +import UIKit +import YogaKit + +class AutoLayoutMixedViewController : UIViewController { + override func viewDidLoad() { + super.viewDidLoad() + + view.configureLayout { (layout) in + layout.isEnabled = true + layout.alignItems = .center + layout.justifyContent = .center + } + + let container = UIView() + container.backgroundColor = .orange + container.configureLayout { (layout) in + layout.isEnabled = true + + layout.paddingTop = 20 + layout.paddingLeft = 20 + layout.paddingBottom = 20 + layout.paddingRight = 70 + + layout.width = 100% + } + view.addSubview(container) + + let subView1 = UIView() + subView1.backgroundColor = .red + subView1.configureLayout { (layout) in + layout.isEnabled = true + layout.height = 30; + } + container.addSubview(subView1) + + let subView2 = UIView() + subView2.backgroundColor = .yellow + subView2.configureLayout { (layout) in + layout.isEnabled = true + layout.marginTop = 25 + layout.height = 10; + } + container.addSubview(subView2) + + let subView3 = UIView() + subView3.backgroundColor = .blue + subView3.configureLayout { (layout) in + layout.isEnabled = true + layout.marginTop = 25 + layout.height = 20; + } + container.addSubview(subView3) + + let subView4 = UIView() + subView4.backgroundColor = .green + subView4.translatesAutoresizingMaskIntoConstraints = false + container.addSubview(subView4) + + container.addConstraints([ + NSLayoutConstraint(item: subView4, attribute: .right, relatedBy: .equal, toItem: container, attribute: .right, multiplier: 1, constant: -10), + NSLayoutConstraint(item: subView4, attribute: .centerY, relatedBy: .equal, toItem: container, attribute: .centerY, multiplier: 1, constant: 0), + NSLayoutConstraint(item: subView4, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 50), + NSLayoutConstraint(item: subView4, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 50) + ]) + } +} diff --git a/YogaKit/YogaKitSample/YogaKitSample/ExamplesViewController.swift b/YogaKit/YogaKitSample/YogaKitSample/ExamplesViewController.swift index f7a19d56..612c88b6 100644 --- a/YogaKit/YogaKitSample/YogaKitSample/ExamplesViewController.swift +++ b/YogaKit/YogaKitSample/YogaKitSample/ExamplesViewController.swift @@ -40,7 +40,8 @@ final class ExamplesViewController: UIViewController, ListAdapterDataSource, Lis // Update this to array to create more examples. private let models: [ExampleModel] = [ExampleModel(title: "Basic Layout", controllerClass: BasicViewController.self), - ExampleModel(title: "Exclude Views in Layout", controllerClass: LayoutInclusionViewController.self)] + ExampleModel(title: "Exclude Views in Layout", controllerClass: LayoutInclusionViewController.self), + ExampleModel(title: "AutoLayout Mixed", controllerClass: AutoLayoutMixedViewController.self)] //MARK: UIViewController -- 2.50.1.windows.1 From b7cc9f9dac5db996be2ec5a37fe2e13793daff1e Mon Sep 17 00:00:00 2001 From: vvveiii Date: Sat, 15 Aug 2020 17:55:00 +0800 Subject: [PATCH 34/38] [Yoga] update unit tests - all unit tests passed --- tests/EventsTest.cpp | 4 ++-- tests/YGAlignBaselineTest.cpp | 14 +++++++------- tests/YGAspectRatioTest.cpp | 4 ++-- tests/YGBaselineFuncTest.cpp | 6 +++--- tests/YGMeasureCacheTest.cpp | 12 ++++++------ tests/YGMeasureModeTest.cpp | 8 ++++---- tests/YGMeasureTest.cpp | 20 ++++++++++---------- tests/YGMinMaxDimensionTest.cpp | 4 ++-- tests/YGNodeCallbackTest.cpp | 28 ++++++++++++++-------------- tests/YGPercentageTest.cpp | 4 ++-- tests/YGRoundingFunctionTest.cpp | 4 ++-- tests/YGRoundingMeasureFuncTest.cpp | 12 ++++++------ 12 files changed, 60 insertions(+), 60 deletions(-) diff --git a/tests/EventsTest.cpp b/tests/EventsTest.cpp index cf887b2d..108e3377 100644 --- a/tests/EventsTest.cpp +++ b/tests/EventsTest.cpp @@ -251,7 +251,7 @@ TEST_F(EventTest, layout_events_has_max_measure_cache) { TEST_F(EventTest, measure_functions_get_wrapped) { auto root = YGNodeNew(); YGNodeSetMeasureFunc( - root, [](YGNodeRef, float, YGMeasureMode, float, YGMeasureMode) { + root, [](YGNodeRef, YGFloat, YGMeasureMode, YGFloat, YGMeasureMode) { return YGSize{}; }); @@ -269,7 +269,7 @@ TEST_F(EventTest, baseline_functions_get_wrapped) { auto child = YGNodeNew(); YGNodeInsertChild(root, child, 0); - YGNodeSetBaselineFunc(child, [](YGNodeRef, float, float) { return 0.0f; }); + YGNodeSetBaselineFunc(child, [](YGNodeRef, YGFloat, YGFloat) { return 0.0; }); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetAlignItems(root, YGAlignBaseline); diff --git a/tests/YGAlignBaselineTest.cpp b/tests/YGAlignBaselineTest.cpp index 35abfe76..2f7903c5 100644 --- a/tests/YGAlignBaselineTest.cpp +++ b/tests/YGAlignBaselineTest.cpp @@ -9,18 +9,18 @@ #include #include -static float _baselineFunc( +static YGFloat _baselineFunc( YGNodeRef node, - const float width, - const float height) { + const YGFloat width, + const YGFloat height) { return height / 2; } static YGSize _measure1( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { return YGSize{ .width = 42, @@ -30,9 +30,9 @@ static YGSize _measure1( static YGSize _measure2( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { return YGSize{ .width = 279, diff --git a/tests/YGAspectRatioTest.cpp b/tests/YGAspectRatioTest.cpp index a1c31ecd..91d2ba7e 100644 --- a/tests/YGAspectRatioTest.cpp +++ b/tests/YGAspectRatioTest.cpp @@ -11,9 +11,9 @@ static YGSize _measure( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { return YGSize{ .width = widthMode == YGMeasureModeExactly ? width : 50, diff --git a/tests/YGBaselineFuncTest.cpp b/tests/YGBaselineFuncTest.cpp index eb15185e..64c01359 100644 --- a/tests/YGBaselineFuncTest.cpp +++ b/tests/YGBaselineFuncTest.cpp @@ -9,8 +9,8 @@ #include #include -static float _baseline(YGNodeRef node, const float width, const float height) { - float* baseline = (float*) node->getContext(); +static YGFloat _baseline(YGNodeRef node, const YGFloat width, const YGFloat height) { + YGFloat* baseline = (YGFloat*) node->getContext(); return *baseline; } @@ -31,7 +31,7 @@ TEST(YogaTest, align_baseline_customer_func) { YGNodeStyleSetHeight(root_child1, 20); YGNodeInsertChild(root, root_child1, 1); - float baselineValue = 10; + YGFloat baselineValue = 10; const YGNodeRef root_child1_child0 = YGNodeNew(); root_child1_child0->setContext(&baselineValue); YGNodeStyleSetWidth(root_child1_child0, 50); diff --git a/tests/YGMeasureCacheTest.cpp b/tests/YGMeasureCacheTest.cpp index 60ad6f47..9efc78b1 100644 --- a/tests/YGMeasureCacheTest.cpp +++ b/tests/YGMeasureCacheTest.cpp @@ -11,9 +11,9 @@ static YGSize _measureMax( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { int* measureCount = (int*) node->getContext(); (*measureCount)++; @@ -26,9 +26,9 @@ static YGSize _measureMax( static YGSize _measureMin( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { int* measureCount = (int*) node->getContext(); *measureCount = *measureCount + 1; @@ -46,9 +46,9 @@ static YGSize _measureMin( static YGSize _measure_84_49( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { int* measureCount = (int*) node->getContext(); if (measureCount) { diff --git a/tests/YGMeasureModeTest.cpp b/tests/YGMeasureModeTest.cpp index 6ed7b2c0..6a12b1c2 100644 --- a/tests/YGMeasureModeTest.cpp +++ b/tests/YGMeasureModeTest.cpp @@ -10,9 +10,9 @@ #include struct _MeasureConstraint { - float width; + YGFloat width; YGMeasureMode widthMode; - float height; + YGFloat height; YGMeasureMode heightMode; }; @@ -23,9 +23,9 @@ struct _MeasureConstraintList { static YGSize _measure( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { struct _MeasureConstraintList* constraintList = (struct _MeasureConstraintList*) node->getContext(); diff --git a/tests/YGMeasureTest.cpp b/tests/YGMeasureTest.cpp index e47607d4..a375305a 100644 --- a/tests/YGMeasureTest.cpp +++ b/tests/YGMeasureTest.cpp @@ -11,9 +11,9 @@ static YGSize _measure( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { int* measureCount = (int*) node->getContext(); if (measureCount) { @@ -28,9 +28,9 @@ static YGSize _measure( static YGSize _simulate_wrapping_text( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { if (widthMode == YGMeasureModeUndefined || width >= 68) { return YGSize{.width = 68, .height = 16}; @@ -44,9 +44,9 @@ static YGSize _simulate_wrapping_text( static YGSize _measure_assert_negative( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { EXPECT_GE(width, 0); EXPECT_GE(height, 0); @@ -643,9 +643,9 @@ TEST(YogaTest, cant_call_negative_measure_horizontal) { static YGSize _measure_90_10( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { return YGSize{ @@ -656,9 +656,9 @@ static YGSize _measure_90_10( static YGSize _measure_100_100( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { return YGSize{ diff --git a/tests/YGMinMaxDimensionTest.cpp b/tests/YGMinMaxDimensionTest.cpp index 621aff4d..2090cfff 100644 --- a/tests/YGMinMaxDimensionTest.cpp +++ b/tests/YGMinMaxDimensionTest.cpp @@ -1298,9 +1298,9 @@ TEST(YogaTest, min_max_percent_no_width_height) { static YGSize _measureCk_test_label_shrink_based_on_height( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { if (heightMode == YGMeasureModeAtMost) { diff --git a/tests/YGNodeCallbackTest.cpp b/tests/YGNodeCallbackTest.cpp index 5e765a0d..b609fd60 100644 --- a/tests/YGNodeCallbackTest.cpp +++ b/tests/YGNodeCallbackTest.cpp @@ -22,7 +22,7 @@ TEST(YGNode, hasMeasureFunc_initial) { TEST(YGNode, hasMeasureFunc_with_measure_fn) { auto n = YGNode{}; - n.setMeasureFunc([](YGNode*, float, YGMeasureMode, float, YGMeasureMode) { + n.setMeasureFunc([](YGNode*, YGFloat, YGMeasureMode, YGFloat, YGMeasureMode) { return YGSize{}; }); ASSERT_TRUE(n.hasMeasureFunc()); @@ -32,7 +32,7 @@ TEST(YGNode, measure_with_measure_fn) { auto n = YGNode{}; n.setMeasureFunc( - [](YGNode*, float w, YGMeasureMode wm, float h, YGMeasureMode hm) { + [](YGNode*, YGFloat w, YGMeasureMode wm, YGFloat h, YGMeasureMode hm) { return YGSize{w * wm, h / hm}; }); @@ -44,7 +44,7 @@ TEST(YGNode, measure_with_measure_fn) { TEST(YGNode, measure_with_context_measure_fn) { auto n = YGNode{}; n.setMeasureFunc( - [](YGNode*, float, YGMeasureMode, float, YGMeasureMode, void* ctx) { + [](YGNode*, YGFloat, YGMeasureMode, YGFloat, YGMeasureMode, void* ctx) { return *(YGSize*) ctx; }); @@ -57,11 +57,11 @@ TEST(YGNode, measure_with_context_measure_fn) { TEST(YGNode, switching_measure_fn_types) { auto n = YGNode{}; n.setMeasureFunc( - [](YGNode*, float, YGMeasureMode, float, YGMeasureMode, void*) { + [](YGNode*, YGFloat, YGMeasureMode, YGFloat, YGMeasureMode, void*) { return YGSize{}; }); n.setMeasureFunc( - [](YGNode*, float w, YGMeasureMode wm, float h, YGMeasureMode hm) { + [](YGNode*, YGFloat w, YGMeasureMode wm, YGFloat h, YGMeasureMode hm) { return YGSize{w * wm, h / hm}; }); @@ -72,7 +72,7 @@ TEST(YGNode, switching_measure_fn_types) { TEST(YGNode, hasMeasureFunc_after_unset) { auto n = YGNode{}; - n.setMeasureFunc([](YGNode*, float, YGMeasureMode, float, YGMeasureMode) { + n.setMeasureFunc([](YGNode*, YGFloat, YGMeasureMode, YGFloat, YGMeasureMode) { return YGSize{}; }); @@ -83,7 +83,7 @@ TEST(YGNode, hasMeasureFunc_after_unset) { TEST(YGNode, hasMeasureFunc_after_unset_context) { auto n = YGNode{}; n.setMeasureFunc( - [](YGNode*, float, YGMeasureMode, float, YGMeasureMode, void*) { + [](YGNode*, YGFloat, YGMeasureMode, YGFloat, YGMeasureMode, void*) { return YGSize{}; }); @@ -98,20 +98,20 @@ TEST(YGNode, hasBaselineFunc_initial) { TEST(YGNode, hasBaselineFunc_with_baseline_fn) { auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float, float) { return 0.0f; }); + n.setBaselineFunc([](YGNode*, YGFloat, YGFloat) { return 0.0; }); ASSERT_TRUE(n.hasBaselineFunc()); } TEST(YGNode, baseline_with_baseline_fn) { auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float w, float h) { return w + h; }); + n.setBaselineFunc([](YGNode*, YGFloat w, YGFloat h) { return w + h; }); ASSERT_EQ(n.baseline(1.25f, 2.5f, nullptr), 3.75f); } TEST(YGNode, baseline_with_context_baseline_fn) { auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float w, float h, void* ctx) { + n.setBaselineFunc([](YGNode*, YGFloat w, YGFloat h, void* ctx) { return w + h + *(float*) ctx; }); @@ -121,7 +121,7 @@ TEST(YGNode, baseline_with_context_baseline_fn) { TEST(YGNode, hasBaselineFunc_after_unset) { auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float, float) { return 0.0f; }); + n.setBaselineFunc([](YGNode*, YGFloat, YGFloat) { return 0.0; }); n.setBaselineFunc(nullptr); ASSERT_FALSE(n.hasBaselineFunc()); @@ -129,7 +129,7 @@ TEST(YGNode, hasBaselineFunc_after_unset) { TEST(YGNode, hasBaselineFunc_after_unset_context) { auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float, float, void*) { return 0.0f; }); + n.setBaselineFunc([](YGNode*, YGFloat, YGFloat, void*) { return 0.0; }); n.setMeasureFunc(nullptr); ASSERT_FALSE(n.hasMeasureFunc()); @@ -137,8 +137,8 @@ TEST(YGNode, hasBaselineFunc_after_unset_context) { TEST(YGNode, switching_baseline_fn_types) { auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float, float, void*) { return 0.0f; }); - n.setBaselineFunc([](YGNode*, float, float) { return 1.0f; }); + n.setBaselineFunc([](YGNode*, YGFloat, YGFloat, void*) { return 0.0; }); + n.setBaselineFunc([](YGNode*, YGFloat, YGFloat) { return 1.0; }); ASSERT_EQ(n.baseline(1, 2, nullptr), 1.0f); } diff --git a/tests/YGPercentageTest.cpp b/tests/YGPercentageTest.cpp index 805df24b..276e2299 100644 --- a/tests/YGPercentageTest.cpp +++ b/tests/YGPercentageTest.cpp @@ -1196,9 +1196,9 @@ TEST(YogaTest, percent_absolute_position) { static YGSize _measureCk_test_label_shrink_based_on_height( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { if (heightMode == YGMeasureModeAtMost) { diff --git a/tests/YGRoundingFunctionTest.cpp b/tests/YGRoundingFunctionTest.cpp index 21daeac6..91e4aa5c 100644 --- a/tests/YGRoundingFunctionTest.cpp +++ b/tests/YGRoundingFunctionTest.cpp @@ -44,9 +44,9 @@ TEST(YogaTest, rounding_value) { static YGSize measureText( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { return (YGSize){.width = 10, .height = 10}; } diff --git a/tests/YGRoundingMeasureFuncTest.cpp b/tests/YGRoundingMeasureFuncTest.cpp index 822e3701..3005f62a 100644 --- a/tests/YGRoundingMeasureFuncTest.cpp +++ b/tests/YGRoundingMeasureFuncTest.cpp @@ -11,9 +11,9 @@ static YGSize _measureFloor( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { return YGSize{ width = 10.2f, @@ -23,9 +23,9 @@ static YGSize _measureFloor( static YGSize _measureCeil( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { return YGSize{ width = 10.5f, @@ -35,9 +35,9 @@ static YGSize _measureCeil( static YGSize _measureFractial( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode) { return YGSize{ width = 0.5f, -- 2.50.1.windows.1 From 3d19f52ba3d702d958eb07fe979c812cd94b7a74 Mon Sep 17 00:00:00 2001 From: vvveiii Date: Sat, 15 Aug 2020 18:22:28 +0800 Subject: [PATCH 35/38] [JNI] fix JNI binding complie error --- java/jni/YGJNIVanilla.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java/jni/YGJNIVanilla.cpp b/java/jni/YGJNIVanilla.cpp index 65343821..fdd95a52 100644 --- a/java/jni/YGJNIVanilla.cpp +++ b/java/jni/YGJNIVanilla.cpp @@ -646,9 +646,9 @@ static void YGTransferLayoutDirection(YGNodeRef node, jobject javaNode) { static YGSize YGJNIMeasureFunc( YGNodeRef node, - float width, + YGFloat width, YGMeasureMode widthMode, - float height, + YGFloat height, YGMeasureMode heightMode, void* layoutContext) { if (auto obj = YGNodeJobject(node, layoutContext)) { @@ -694,10 +694,10 @@ static void jni_YGNodeSetHasMeasureFuncJNI( ->setMeasureFunc(hasMeasureFunc ? YGJNIMeasureFunc : nullptr); } -static float YGJNIBaselineFunc( +static YGFloat YGJNIBaselineFunc( YGNodeRef node, - float width, - float height, + YGFloat width, + YGFloat height, void* layoutContext) { if (auto obj = YGNodeJobject(node, layoutContext)) { JNIEnv* env = getCurrentEnv(); -- 2.50.1.windows.1 From ac326555b9ffa687b9d171ddb81958b16b9045bd Mon Sep 17 00:00:00 2001 From: vvveiii Date: Sat, 15 Aug 2020 18:49:08 +0800 Subject: [PATCH 36/38] [YogaKit] add YogaKit.h to public headers. --- YogaKit.podspec | 2 +- YogaKit/YogaKitSample/Podfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/YogaKit.podspec b/YogaKit.podspec index 22c51232..5e7562e8 100644 --- a/YogaKit.podspec +++ b/YogaKit.podspec @@ -27,7 +27,7 @@ podspec = Pod::Spec.new do |spec| # https://twitter.com/krzyzanowskim/status/1151549874653081601?s=21 spec.pod_target_xcconfig = {"LD_VERIFY_BITCODE": "NO"} spec.source_files = 'YogaKit/Source/*.{h,m,swift}' - spec.public_header_files = 'YogaKit/Source/{YGLayout,UIView+Yoga}.h' + spec.public_header_files = 'YogaKit/Source/{YGLayout,UIView+Yoga,YogaKit}.h' spec.private_header_files = 'YogaKit/Source/YGLayout+Private.h' spec.swift_version = '5.1' spec.static_framework = true diff --git a/YogaKit/YogaKitSample/Podfile.lock b/YogaKit/YogaKitSample/Podfile.lock index 048f6dde..0d33f706 100644 --- a/YogaKit/YogaKitSample/Podfile.lock +++ b/YogaKit/YogaKitSample/Podfile.lock @@ -26,7 +26,7 @@ SPEC CHECKSUMS: IGListDiffKit: 665d6cf43ce726e676013db9c7d6c4294259b6b2 IGListKit: fd5a5d21935298f5849fa49d426843cff97b77c7 Yoga: 21a6025b8ce1624d5bf5202b1af67cd43da8edfc - YogaKit: 30573590c8d1ecd5c3758efba7117ad9cb1c8508 + YogaKit: c404496039efd6abb76408c15804180a247908f5 PODFILE CHECKSUM: e8d71f0fe05bb5e3cfd81b54d07bd1a904e18968 -- 2.50.1.windows.1 From 730f46bcf14ba298169f1666f7380d726668565f Mon Sep 17 00:00:00 2001 From: vvveiii Date: Sat, 15 Aug 2020 23:55:28 +0800 Subject: [PATCH 37/38] [Yoga] replace float with YGFloat --- YogaKit/Source/YGLayout.m | 4 ++-- YogaKit/Source/YGLayoutExtensions.swift | 14 +++++++------- yoga/CompactValue.h | 22 +++++++++++----------- yoga/YGValue.h | 8 ++++---- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index b3baa8f5..acdbf77a 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -149,11 +149,11 @@ lowercased_name, capitalized_name, capitalized_name, YGEdgeAll) YGValue YGPointValue(CGFloat value) { - return (YGValue){.value = (float)value, .unit = YGUnitPoint}; + return (YGValue){.value = (YGFloat)value, .unit = YGUnitPoint}; } YGValue YGPercentValue(CGFloat value) { - return (YGValue){.value = (float)value, .unit = YGUnitPercent}; + return (YGValue){.value = (YGFloat)value, .unit = YGUnitPercent}; } static CGFloat YGScaleFactor() { diff --git a/YogaKit/Source/YGLayoutExtensions.swift b/YogaKit/Source/YGLayoutExtensions.swift index 5bc191aa..5960f3d8 100644 --- a/YogaKit/Source/YGLayoutExtensions.swift +++ b/YogaKit/Source/YGLayoutExtensions.swift @@ -10,36 +10,36 @@ postfix operator % extension Int { public static postfix func %(value: Int) -> YGValue { - return YGValue(value: Float(value), unit: .percent) + return YGValue(value: YGFloat(value), unit: .percent) } } extension Float { public static postfix func %(value: Float) -> YGValue { - return YGValue(value: value, unit: .percent) + return YGValue(value: YGFloat(value), unit: .percent) } } extension CGFloat { public static postfix func %(value: CGFloat) -> YGValue { - return YGValue(value: Float(value), unit: .percent) + return YGValue(value: YGFloat(value), unit: .percent) } } extension YGValue : ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral { public init(integerLiteral value: Int) { - self = YGValue(value: Float(value), unit: .point) + self = YGValue(value: YGFloat(value), unit: .point) } public init(floatLiteral value: Float) { - self = YGValue(value: value, unit: .point) + self = YGValue(value: YGFloat(value), unit: .point) } public init(_ value: Float) { - self = YGValue(value: value, unit: .point) + self = YGValue(value: YGFloat(value), unit: .point) } public init(_ value: CGFloat) { - self = YGValue(value: Float(value), unit: .point) + self = YGValue(value: YGFloat(value), unit: .point) } } diff --git a/yoga/CompactValue.h b/yoga/CompactValue.h index be933a16..63e0c173 100644 --- a/yoga/CompactValue.h +++ b/yoga/CompactValue.h @@ -14,7 +14,7 @@ #include static_assert( - std::numeric_limits::is_iec559, + std::numeric_limits::is_iec559, "facebook::yoga::detail::CompactValue only works with IEEE754 floats"); #ifdef YOGA_COMPACT_VALUE_TEST @@ -49,7 +49,7 @@ public: static constexpr auto UPPER_BOUND_PERCENT = 18446742974197923840.0f; template - static CompactValue of(float value) noexcept { + static CompactValue of(YGFloat value) noexcept { if (value == 0.0f || (value < LOWER_BOUND && value > -LOWER_BOUND)) { constexpr auto zero = Unit == YGUnitPercent ? ZERO_BITS_PERCENT : ZERO_BITS_POINT; @@ -70,7 +70,7 @@ public: } template - static CompactValue ofMaybe(float value) noexcept { + static CompactValue ofMaybe(YGFloat value) noexcept { return std::isnan(value) || std::isinf(value) ? ofUndefined() : of(value); } @@ -88,7 +88,7 @@ public: } constexpr CompactValue() noexcept - : payload_(std::numeric_limits::quiet_NaN()) {} + : payload_(std::numeric_limits::quiet_NaN()) {} CompactValue(const YGValue& x) noexcept : payload_(uint32_t{0}) { switch (x.unit) { @@ -112,9 +112,9 @@ public: case AUTO_BITS: return YGValueAuto; case ZERO_BITS_POINT: - return YGValue{0.0f, YGUnitPoint}; + return YGValue{0.0, YGUnitPoint}; case ZERO_BITS_PERCENT: - return YGValue{0.0f, YGUnitPercent}; + return YGValue{0.0, YGUnitPercent}; } if (std::isnan(payload_.value)) { @@ -143,7 +143,7 @@ private: uint32_t repr; Payload() = delete; constexpr Payload(uint32_t r) : repr(r) {} - constexpr Payload(float v) : value(v) {} + constexpr Payload(YGFloat v) : value(v) {} }; static constexpr uint32_t BIAS = 0x20000000; @@ -163,13 +163,13 @@ private: }; template <> -CompactValue CompactValue::of(float) noexcept = delete; +CompactValue CompactValue::of(YGFloat) noexcept = delete; template <> -CompactValue CompactValue::of(float) noexcept = delete; +CompactValue CompactValue::of(YGFloat) noexcept = delete; template <> -CompactValue CompactValue::ofMaybe(float) noexcept = delete; +CompactValue CompactValue::ofMaybe(YGFloat) noexcept = delete; template <> -CompactValue CompactValue::ofMaybe(float) noexcept = delete; +CompactValue CompactValue::ofMaybe(YGFloat) noexcept = delete; constexpr bool operator==(CompactValue a, CompactValue b) noexcept { return a.payload_.repr == b.payload_.repr; diff --git a/yoga/YGValue.h b/yoga/YGValue.h index 32659678..e118211e 100644 --- a/yoga/YGValue.h +++ b/yoga/YGValue.h @@ -17,7 +17,7 @@ #if defined(COMPILING_WITH_CLANG_ON_WINDOWS) YG_EXTERN_CXX_BEGIN #include -constexpr float YGUndefined = std::numeric_limits::quiet_NaN(); +constexpr YGFloat YGUndefined = std::numeric_limits::quiet_NaN(); YG_EXTERN_C_END #else YG_EXTERN_C_BEGIN @@ -32,7 +32,7 @@ static const uint32_t __nan = 0x7fc00000; #endif typedef struct YGValue { - float value; + YGFloat value; YGUnit unit; } YGValue; @@ -78,14 +78,14 @@ namespace yoga { namespace literals { inline YGValue operator"" _pt(long double value) { - return YGValue{static_cast(value), YGUnitPoint}; + return YGValue{static_cast(value), YGUnitPoint}; } inline YGValue operator"" _pt(unsigned long long value) { return operator"" _pt(static_cast(value)); } inline YGValue operator"" _percent(long double value) { - return YGValue{static_cast(value), YGUnitPercent}; + return YGValue{static_cast(value), YGUnitPercent}; } inline YGValue operator"" _percent(unsigned long long value) { return operator"" _percent(static_cast(value)); -- 2.50.1.windows.1 From 973e2f7f1720e69cc6e6827030c7ff3770a254ff Mon Sep 17 00:00:00 2001 From: vvveiii Date: Sun, 16 Aug 2020 13:59:20 +0800 Subject: [PATCH 38/38] [Yoga] using float in CompactValue.h --- yoga/CompactValue.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yoga/CompactValue.h b/yoga/CompactValue.h index 63e0c173..bfb0583e 100644 --- a/yoga/CompactValue.h +++ b/yoga/CompactValue.h @@ -14,7 +14,7 @@ #include static_assert( - std::numeric_limits::is_iec559, + std::numeric_limits::is_iec559, "facebook::yoga::detail::CompactValue only works with IEEE754 floats"); #ifdef YOGA_COMPACT_VALUE_TEST @@ -49,7 +49,7 @@ public: static constexpr auto UPPER_BOUND_PERCENT = 18446742974197923840.0f; template - static CompactValue of(YGFloat value) noexcept { + static CompactValue of(float value) noexcept { if (value == 0.0f || (value < LOWER_BOUND && value > -LOWER_BOUND)) { constexpr auto zero = Unit == YGUnitPercent ? ZERO_BITS_PERCENT : ZERO_BITS_POINT; @@ -70,7 +70,7 @@ public: } template - static CompactValue ofMaybe(YGFloat value) noexcept { + static CompactValue ofMaybe(float value) noexcept { return std::isnan(value) || std::isinf(value) ? ofUndefined() : of(value); } @@ -88,7 +88,7 @@ public: } constexpr CompactValue() noexcept - : payload_(std::numeric_limits::quiet_NaN()) {} + : payload_(std::numeric_limits::quiet_NaN()) {} CompactValue(const YGValue& x) noexcept : payload_(uint32_t{0}) { switch (x.unit) { @@ -143,7 +143,7 @@ private: uint32_t repr; Payload() = delete; constexpr Payload(uint32_t r) : repr(r) {} - constexpr Payload(YGFloat v) : value(v) {} + constexpr Payload(float v) : value(v) {} }; static constexpr uint32_t BIAS = 0x20000000; @@ -163,13 +163,13 @@ private: }; template <> -CompactValue CompactValue::of(YGFloat) noexcept = delete; +CompactValue CompactValue::of(float) noexcept = delete; template <> -CompactValue CompactValue::of(YGFloat) noexcept = delete; +CompactValue CompactValue::of(float) noexcept = delete; template <> -CompactValue CompactValue::ofMaybe(YGFloat) noexcept = delete; +CompactValue CompactValue::ofMaybe(float) noexcept = delete; template <> -CompactValue CompactValue::ofMaybe(YGFloat) noexcept = delete; +CompactValue CompactValue::ofMaybe(float) noexcept = delete; constexpr bool operator==(CompactValue a, CompactValue b) noexcept { return a.payload_.repr == b.payload_.repr; -- 2.50.1.windows.1