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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'synx'
gem 'cocoapods'
81 changes: 81 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
activesupport (4.2.10)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
claide (1.0.2)
clamp (0.6.5)
cocoapods (1.3.1)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.3.1)
cocoapods-deintegrate (>= 1.0.1, < 2.0)
cocoapods-downloader (>= 1.1.3, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.2.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (~> 2.0.1)
gh_inspector (~> 1.0)
molinillo (~> 0.5.7)
nap (~> 1.0)
ruby-macho (~> 1.1)
xcodeproj (>= 1.5.1, < 2.0)
cocoapods-core (1.3.1)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
colorize (0.8.1)
concurrent-ruby (1.0.5)
escape (0.0.4)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.0.3)
i18n (0.9.1)
concurrent-ruby (~> 1.0)
minitest (5.11.1)
molinillo (0.5.7)
nanaimo (0.2.3)
nap (1.1.0)
netrc (0.11.0)
ruby-macho (1.1.0)
synx (0.2.1)
clamp (~> 0.6)
colorize (~> 0.7)
xcodeproj (~> 1.0)
thread_safe (0.3.6)
tzinfo (1.2.4)
thread_safe (~> 0.1)
xcodeproj (1.5.4)
CFPropertyList (~> 2.3.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.3)

PLATFORMS
ruby

DEPENDENCIES
cocoapods
synx

BUNDLED WITH
1.13.1
37 changes: 24 additions & 13 deletions LayoutFrameworkBenchmark.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
isa = PBXGroup;
children = (
2401BCA21F4F045600788998 /* AutoLayout */,
2401BC9F1F4F043800788998 /* UIStackView */,
2401BC9C1F4F041400788998 /* ManualLayout */,
2401BC921F4F020D00788998 /* FlexLayout */,
2401BC8D1F4F01CC00788998 /* LayoutKit */,
2401BC9C1F4F041400788998 /* ManualLayout */,
2401BC911F4F020600788998 /* PinLayout */,
2401BC9F1F4F043800788998 /* UIStackView */,
2401BC751F4F018C00788998 /* BenchmarkViewController.swift */,
2401BC761F4F018C00788998 /* CollectionViewController.swift */,
2401BC771F4F018C00788998 /* DataBinder.swift */,
Expand Down Expand Up @@ -215,11 +215,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0920;
TargetAttributes = {
24661CFB1F4EFFF5002CB883 = {
CreatedOnToolsVersion = 8.3.2;
DevelopmentTeam = 4Q596JWQC5;
LastSwiftMigration = 0920;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -280,18 +281,14 @@
"${BUILT_PRODUCTS_DIR}/FlexLayout/FlexLayout.framework",
"${BUILT_PRODUCTS_DIR}/LayoutKit/LayoutKit.framework",
"${BUILT_PRODUCTS_DIR}/PinLayout/PinLayout.framework",
"${PODS_ROOT}/Reveal-SDK/RevealServer-10/iOS/RevealServer.framework",
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
"${BUILT_PRODUCTS_DIR}/YogaKit/YogaKit.framework",
"${PODS_ROOT}/Reveal-SDK/RevealServer-13/iOS/RevealServer.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FlexLayout.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LayoutKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PinLayout.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RevealServer.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YogaKit.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand All @@ -313,7 +310,7 @@
);
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";
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;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -364,15 +361,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -395,7 +398,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -415,15 +418,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -440,7 +449,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -461,7 +470,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.lucdion.LayoutFrameworkBenchmark;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -477,7 +487,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.lucdion.LayoutFrameworkBenchmark;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
"idiom" : "ipad",
"filename" : "Icon-167.png",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class CommentView: UIView {
let actorImageView: UIImageView = {
let i = UIImageView()
i.image = UIImage(named: "50x50.png")
i.setContentHuggingPriority(UILayoutPriorityRequired, for: .horizontal)
i.setContentCompressionResistancePriority(UILayoutPriorityRequired, for: .horizontal)
i.setContentHuggingPriority(UILayoutPriority.required, for: .horizontal)
i.setContentCompressionResistancePriority(UILayoutPriority.required, for: .horizontal)
return i
}()

Expand Down Expand Up @@ -130,8 +130,8 @@ class MiniProfileView: UIView {
i.image = UIImage(named: "50x50.png")
i.backgroundColor = UIColor.orange
i.contentMode = .center
i.setContentHuggingPriority(UILayoutPriorityRequired, for: .horizontal)
i.setContentCompressionResistancePriority(UILayoutPriorityRequired, for: .horizontal)
i.setContentHuggingPriority(UILayoutPriority.required, for: .horizontal)
i.setContentCompressionResistancePriority(UILayoutPriority.required, for: .horizontal)
return i
}()

Expand Down Expand Up @@ -228,8 +228,8 @@ class TopBarView: UIView {
let optionsLabel: UILabel = {
let l = UILabel()
l.text = "..."
l.setContentHuggingPriority(UILayoutPriorityRequired, for: .horizontal)
l.setContentCompressionResistancePriority(UILayoutPriorityRequired, for: .horizontal)
l.setContentHuggingPriority(UILayoutPriority.required, for: .horizontal)
l.setContentCompressionResistancePriority(UILayoutPriority.required, for: .horizontal)
return l
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class BenchmarkViewController: UITableViewController {
return CollectionViewControllerFeedItemAutoLayoutView(data: data)
}),

ViewControllerData(title: "FlexLayout", factoryBlock: { viewCount in
ViewControllerData(title: "FlexLayout 1.3", factoryBlock: { viewCount in
let data = FeedItemData.generate(count: viewCount)
return CollectionViewControllerFeedItemFlexLayoutView(data: data)
}),

ViewControllerData(title: "LayoutKit", factoryBlock: { viewCount in
ViewControllerData(title: "LayoutKit 7.0", factoryBlock: { viewCount in
let data = FeedItemData.generate(count: viewCount)
return CollectionViewControllerFeedItemLayoutKitView(data: data)
}),
Expand All @@ -39,7 +39,7 @@ class BenchmarkViewController: UITableViewController {
return CollectionViewControllerFeedItemManualView(data: data)
}),

ViewControllerData(title: "PinLayout", factoryBlock: { viewCount in
ViewControllerData(title: "PinLayout 1.5", factoryBlock: { viewCount in
let data = FeedItemData.generate(count: viewCount)
return CollectionViewControllerFeedItemPinLayoutView(data: data)
}),
Expand Down Expand Up @@ -101,7 +101,7 @@ class BenchmarkViewController: UITableViewController {
func benchmarkCompleted(_ results: [Result]) {
printResults(name: viewControllers[benchmarkIndex].title, results: results)

Timer.scheduledTimer(withTimeInterval: 0, repeats: false, block: { (_) in
DispatchQueue.main.async {
self.navigationController?.popViewController(animated: false)

benchmarkIndex += 1
Expand All @@ -110,7 +110,7 @@ class BenchmarkViewController: UITableViewController {
} else {
print("Completed!")
}
})
}
}

runBenchmark(viewControllerData: viewControllers[benchmarkIndex], logResults: false, completed: benchmarkCompleted)
Expand All @@ -136,9 +136,10 @@ class BenchmarkViewController: UITableViewController {
}

private func benchmark(_ viewControllerData: ViewControllerData, logResults: Bool, completed: ((_ results: [Result]) -> Void)?) {
// let iterations = [1]
let iterations = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
var results: [Result] = []

for i in iterations {
let description = "\(i)\tsubviews\t\(viewControllerData.title)"
let result = Stopwatch.benchmark(description, logResults: logResults, block: { (stopwatch: Stopwatch) -> Void in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

import UIKit
import PinLayout
import FlexLayout

/// A LinkedIn feed item that is implemented with PinLayout code.
/// A LinkedIn feed item that is implemented with FlexLayout code.
class FeedItemFlexLayoutView: UIView, DataBinder {

let contentView = UIView()
Expand Down Expand Up @@ -172,15 +171,15 @@ class FeedItemFlexLayoutView: UIView, DataBinder {
override func layoutSubviews() {
super.layoutSubviews()

layoutFlexbox(size: bounds.size)
layout(size: bounds.size)
}

fileprivate func layoutFlexbox(size: CGSize) {
fileprivate func layout(size: CGSize) {
flex.size(size).layout()
}

override func sizeThatFits(_ size: CGSize) -> CGSize {
layoutFlexbox(size: CGSize(width: size.width != .greatestFiniteMagnitude ? size.width : 10000,
layout(size: CGSize(width: size.width != .greatestFiniteMagnitude ? size.width : 10000,
height: size.height != .greatestFiniteMagnitude ? size.height : 10000))
return CGSize(width: size.width, height: contentView.frame.height + 4)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class FeedItemPinLayoutView: UIView, DataBinder {
contentDomainLabel.pin.below(of: contentTitleLabel, aligned: .left).right().marginRight(hMargin).sizeToFit(.width)

likeLabel.pin.below(of: contentDomainLabel, aligned: .left).marginTop(vMargin)
commentLabel.pin.top(to: likeLabel.edge.top).hCenter(50%)
commentLabel.pin.top(to: likeLabel.edge.top).hCenter()
shareLabel.pin.top(to: likeLabel.edge.top).right().marginRight(hMargin)

actorImageView.pin.below(of: likeLabel, aligned: .left).marginTop(vMargin)
Expand Down
Loading