Skip to content

Commit

Permalink
Merge branch feature/safe-area-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Kormakov committed Aug 21, 2019
2 parents 54e3688 + 1ad8bc8 commit da6791d
Show file tree
Hide file tree
Showing 17 changed files with 350 additions and 331 deletions.
15 changes: 0 additions & 15 deletions Framezilla.podspec

This file was deleted.

23 changes: 9 additions & 14 deletions Framezilla.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
11FB41421D844F8F00700A40 /* MakerHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MakerHelper.swift; sourceTree = "<group>"; };
11FB41431D844F8F00700A40 /* UIView+Installer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Installer.swift"; sourceTree = "<group>"; };
11FB41441D844F8F00700A40 /* UIView+Relations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Relations.swift"; sourceTree = "<group>"; };
11FB414A1D844FFA00700A40 /* Framezilla.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Framezilla.podspec; sourceTree = "<group>"; };
11FB414B1D844FFA00700A40 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
11FB414C1D844FFA00700A40 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
841192DC1FF205DC00AB255D /* ContainerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -97,7 +96,6 @@
11FB41261D844CD800700A40 = {
isa = PBXGroup;
children = (
11FB414A1D844FFA00700A40 /* Framezilla.podspec */,
11FB414B1D844FFA00700A40 /* LICENSE */,
11FB414C1D844FFA00700A40 /* README.md */,
11FB413B1D844D5A00700A40 /* Sources */,
Expand Down Expand Up @@ -212,28 +210,29 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = Rosberry;
LastUpgradeCheck = 1020;
TargetAttributes = {
115972131D8450F500BC5C20 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Manual;
};
11FB41311D844D2B00700A40 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 11FB412A1D844CD800700A40 /* Build configuration list for PBXProject "Framezilla" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
mainGroup = 11FB41261D844CD800700A40;
productRefGroup = 11FB41331D844D2C00700A40 /* Products */;
Expand Down Expand Up @@ -380,8 +379,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/FramezillaTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -430,8 +428,7 @@
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/FramezillaTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down Expand Up @@ -558,8 +555,7 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -616,8 +612,7 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.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 = "0900"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ In iOS 11 Apple has introduced the safe area, similar to `topLayoutGuide` and `b

```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)
maker.top(to: view.nui_safeArea.top)
maker.bottom(to: view.nui_safeArea.bottom)
maker.right(to: view.nui_safeArea.right, inset: 10)
maker.left(to: view.nui_safeArea.left, inset: 10)
}
```

Expand Down
14 changes: 7 additions & 7 deletions Sources/Array+Stack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ public enum StackAxis: Int {
}

public extension Collection where Iterator.Element: UIView, Self.Index == Int {

/// Arranges views in the order of list along a vertical or horizontal axis, with spacing property.
///
/// - note: You have to change the `nx_state` of the container, not the arranged subviews.
///
/// - parameter axis: A stack with a horizontal axis is a row of arranged subviews, and a stack with a vertical axis is a column of arranged subviews.
/// - parameter spacing: Spacing between arranged subviews.
/// - parameter state: The state for which you configure frame.
public func stack(axis: StackAxis, spacing: Number = 0.0, state: AnyHashable = DEFAULT_STATE) {

func stack(axis: StackAxis, spacing: Number = 0.0, state: AnyHashable = DEFAULT_STATE) {
for view in self {
guard view.superview != nil else {
assertionFailure("Can not configure stack relation without superview.")
Expand All @@ -33,14 +33,14 @@ public extension Collection where Iterator.Element: UIView, Self.Index == Int {
for view in self where view.superview != superview {
assertionFailure("All views should have the same superview.")
}

guard superview.nx_state == state else {
return
}

let count = CGFloat(self.count)
var prevView = self[0]

switch axis {
case .horizontal:
let width = (superview.bounds.width - (count - 1) * spacing.value) / count
Expand Down Expand Up @@ -74,7 +74,7 @@ public extension Collection where Iterator.Element: UIView, Self.Index == Int {
}
prevView = view
}

}
}
}
8 changes: 4 additions & 4 deletions Sources/Maker+Configurations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ public postfix func >> (maker: Maker) {
public typealias InstallerBlock = (Maker) -> Void

extension Maker {

class func configure(view: UIView, for state: AnyHashable, installerBlock: InstallerBlock) {
if view.nx_state == state {
let maker = Maker(view: view)

maker.newRect = view.frame
installerBlock(maker)

maker.configureFrame()
}
}

fileprivate func configureFrame() {
handlers.sorted {
$0.priority.rawValue <= $1.priority.rawValue
Expand Down
8 changes: 4 additions & 4 deletions Sources/Maker+Unavailable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
import Foundation

extension Maker {

/// Calculates the width that best fits the specified size.
///
/// - returns: `Maker` instance for chaining relations.

@available(*, unavailable, renamed: "widthThatFits(maxWidth:)")
@discardableResult public func widthThatFits(width: Number) -> Maker {
return self
}

/// Calculates the height that best fits the specified size.
///
/// - returns: `Maker` instance for chaining relations.

@available(*, unavailable, renamed: "heightThatFits(maxHeight:)")
@discardableResult public func heightThatFits(height: Number) -> Maker {
return self
Expand Down
Loading

0 comments on commit da6791d

Please sign in to comment.