Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Otbivnoe committed Oct 21, 2017
2 parents 46b0490 + 843e06e commit f652993
Show file tree
Hide file tree
Showing 12 changed files with 442 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type_body_length:
- 400 # error

file_length:
warning: 800
warning: 1000
error: 1200

colon:
Expand Down
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
language: objective-c
osx_image: xcode8
osx_image: xcode9
env:
global:
- PROJECT=Framezilla.xcodeproj
- IOS_FRAMEWORK_SCHEME="Framezilla iOS"
- IOS_SDK=iphonesimulator10.0
- IOS_SDK=iphonesimulator11.0
matrix:
- DESTINATION="OS=10.0,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK"
- DESTINATION="OS=10.0,name=iPhone 7 Plus"
- DESTINATION="OS=11.0,name=iPhone 7 Plus"

script:
- set -o pipefail
Expand Down
14 changes: 13 additions & 1 deletion Example/FramezillaExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Nikita Ermolenko";
TargetAttributes = {
8442F94E1EC75C9C00B72551 = {
Expand Down Expand Up @@ -193,15 +193,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 Down Expand Up @@ -244,15 +250,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 Down
56 changes: 11 additions & 45 deletions Example/FramezillaExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,63 +22,29 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

if #available(iOS 11.0, *) {
additionalSafeAreaInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
}

scrollView.backgroundColor = .yellow
scrollView.contentSize = CGSize(width: 500, height: 1000)

content1.backgroundColor = .red
content2.backgroundColor = .green
content3.backgroundColor = .black

view.addSubview(scrollView)
scrollView.addSubview(content2)

// view.addSubview(content3)
view.backgroundColor = .yellow
view.addSubview(content1)
}

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()

// content1.configureFrame { maker in
// maker.edges(top: 0, left: 0, right: 0)
// maker.height(50)
// }
//
// content2.configureFrame { maker in
// maker.edges(left: 0, bottom: 0, right: 0)
// maker.height(200)
// }
//
// content3.configureFrame { maker in
// maker.size(width: 20, height: 70)
// maker.centerY(between: content2, content1)
// maker.centerX()
// }


// content1.configureFrame { maker in
// maker.edges(top: 0, left: 0, bottom: 0)
// maker.width(50)
// }
//
// content2.configureFrame { maker in
// maker.edges(top: 0, bottom: 0, right: 0)
// maker.width(200)
// }
//
// content3.configureFrame { maker in
// maker.size(width: 20, height: 70)
// maker.centerX(between: content1, content2)
// maker.centerY()
// }

scrollView.configureFrame { maker in
maker.margin(20)
}

content2.configureFrame { maker in
maker.size(width: 100, height: 100)
maker.left()
maker.centerY()
content1.configureFrame { maker in
maker.top(to: nui_safeArea)
maker.bottom(to: nui_safeArea)
maker.right(to: nui_safeArea)
maker.left(to: nui_safeArea)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Framezilla.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "Framezilla"
spec.version = "2.2.1"
spec.version = "2.3.0"
spec.summary = "Comfortable syntax for working with frames."

spec.homepage = "https://github.com/Otbivnoe/Framezilla"
Expand Down
34 changes: 27 additions & 7 deletions Framezilla.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
845108071EE2F5BC006DC1C8 /* ScrollViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845108061EE2F5BC006DC1C8 /* ScrollViewTests.swift */; };
8497C0111E59EB7700447E2F /* Number.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8497C0101E59EB7700447E2F /* Number.swift */; };
8497C0131E59FA4B00447E2F /* Array+Stack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8497C0121E59FA4B00447E2F /* Array+Stack.swift */; };
84EDCC241F9B3AB10091FAB9 /* MakerSafeAreaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84EDCC231F9B3AB10091FAB9 /* MakerSafeAreaTests.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -63,6 +64,7 @@
845108061EE2F5BC006DC1C8 /* ScrollViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScrollViewTests.swift; sourceTree = "<group>"; };
8497C0101E59EB7700447E2F /* Number.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Number.swift; sourceTree = "<group>"; };
8497C0121E59FA4B00447E2F /* Array+Stack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Array+Stack.swift"; sourceTree = "<group>"; };
84EDCC231F9B3AB10091FAB9 /* MakerSafeAreaTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MakerSafeAreaTests.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -133,6 +135,7 @@
8442F93A1EC75A8500B72551 /* MakerStackTests.swift */,
8442F93B1EC75A8500B72551 /* MakerTests.swift */,
8442F93C1EC75A8500B72551 /* MakerWidthHeightTests.swift */,
84EDCC231F9B3AB10091FAB9 /* MakerSafeAreaTests.swift */,
8442F93D1EC75A8500B72551 /* StateTests.swift */,
845108061EE2F5BC006DC1C8 /* ScrollViewTests.swift */,
);
Expand Down Expand Up @@ -197,16 +200,16 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0900;
TargetAttributes = {
115972131D8450F500BC5C20 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
11FB41311D844D2B00700A40 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -276,6 +279,7 @@
845108071EE2F5BC006DC1C8 /* ScrollViewTests.swift in Sources */,
8442F9431EC75A8500B72551 /* MakerTests.swift in Sources */,
8442F93E1EC75A8500B72551 /* BaseTest.swift in Sources */,
84EDCC241F9B3AB10091FAB9 /* MakerSafeAreaTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -358,7 +362,8 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/FramezillaTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand Down Expand Up @@ -407,20 +412,27 @@
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/FramezillaTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
11FB412B1D844CD800700A40 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_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,12 +452,18 @@
11FB412C1D844CD800700A40 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_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 Down Expand Up @@ -518,7 +536,8 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -575,7 +594,8 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
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 = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,9 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -55,6 +57,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Version](https://img.shields.io/cocoapods/v/Framezilla.svg?style=flat)](http://cocoadocs.org/docsets/Framezilla)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Platform](https://img.shields.io/cocoapods/p/Framezilla.svg?style=flat)](http://cocoadocs.org/docsets/Framezilla)
![Swift 3.0.x](https://img.shields.io/badge/Swift-3.0.x-orange.svg)
![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg)
[![License](https://img.shields.io/cocoapods/l/Framezilla.svg?style=flat)](http://cocoadocs.org/docsets/Framezilla)

**Everyone wants to see a smooth scrolling, that tableview or collectionview scrolls without any lags and it's a right choice. But the constraints do not give it for us. Therefore, we have to choose manual calculation frames, but sometimes, when cell has a complex structure, code has not an elegant, beautiful structure.**
Expand Down Expand Up @@ -69,6 +69,7 @@ Run `carthage update` to build the framework and drag the built `Framezilla.fram
- [x] Optional semantic - `and`
- [x] Side relations: `nui_left`, `nui_bottom`, `nui_width`, `nui_centerX` and so on.
- [x] States
- [x] Safe area support 😱

# Usage :rocket:

Expand Down Expand Up @@ -152,6 +153,21 @@ Also possible to create relations with another view, not a superview:
}
```

In iOS 11 Apple has introduced the safe area, similar to `topLayoutGuide` and `bottomLayoutGuide`. Framezilla supports this new api as well:

```swift
content.configureFrame { maker in
maker.top(to: nui_safeArea)
maker.bottom(to: nui_safeArea)
maker.right(to: nui_safeArea, inset: 10)
maker.left(to: nui_safeArea, inset: 10)
}
```

<img src="img/safe_area.png" width="260">

**Note**: In earlier versions of OS than iOS 11, these methods create a relation to a superview, not the safe area.

## Center relations

If you just want to center subview relative superview with constant `width` and `height`, this approach specially for you:
Expand Down
Loading

0 comments on commit f652993

Please sign in to comment.