Skip to content

Commit

Permalink
Merge branch 'feature/flexible-container' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Ermolenko committed Dec 26, 2017
2 parents 86d862e + 653f6b7 commit 2ba927c
Show file tree
Hide file tree
Showing 7 changed files with 314 additions and 99 deletions.
87 changes: 71 additions & 16 deletions Example/FramezillaExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ViewController: UIViewController {
let content1 = UIView()
let content2 = UIView()
let content3 = UIView()
let content4 = UIView()

override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -23,31 +24,85 @@ class ViewController: UIViewController {
content1.backgroundColor = .red
content2.backgroundColor = .black
content3.backgroundColor = .green

view.addSubview(content1)
view.addSubview(content2)
view.addSubview(content3)
content4.backgroundColor = .gray
}

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()

content3.configureFrame { maker in
maker.size(width: 50, height: 50)
maker.top(inset: 100)
maker.centerX(between: view.nui_left, view.nui_right)
}
// let container = [content1, content2, content3, content4].container(in: view) {
// content1.configureFrame { maker in
// maker.centerX()
// maker.top()
// maker.size(width: 50, height: 50)
// }
//
// content2.configureFrame { maker in
// maker.top(to: content1.nui_bottom, inset: 5)
// maker.left()
// maker.size(width: 80, height: 80)
// }
//
// content3.configureFrame { maker in
// maker.top(to: content1.nui_bottom, inset: 15)
// maker.left(to: content2.nui_right, inset: 5)
// maker.size(width: 80, height: 80)
// }
//
// content4.configureFrame { maker in
// maker.top(to: content3.nui_bottom, inset: 5)
// maker.right()
// maker.size(width: 20, height: 20)
// }
// }


content1.configureFrame { maker in
maker.bottom(inset: 100)
maker.right().left()
maker.height(10)

let container = [content1, content2, content3].container(in: view) {
content1.configureFrame { maker in
maker.right()
maker.centerY()
maker.size(width: 50, height: 50)
}

content2.configureFrame { maker in
maker.right(to: content1.nui_left, inset: 5)
maker.centerY()
maker.size(width: 30, height: 140)
}

content3.configureFrame { maker in
maker.right(to: content2.nui_left, inset: 15)
maker.centerY()
maker.size(width: 80, height: 80)
}
}

content2.configureFrame { maker in
maker.size(width: 50, height: 50)

// let container = [content1, content2, content3].container(in: view) {
// content1.configureFrame { maker in
// maker.bottom()
// maker.centerX()
// maker.size(width: 50, height: 50)
// }
//
// content2.configureFrame { maker in
// maker.bottom(to: content1.nui_top, inset: 5)
// maker.centerX()
// maker.size(width: 30, height: 140)
// }
//
// content3.configureFrame { maker in
// maker.left()
// maker.bottom(to: content2.nui_top, inset: 15)
// maker.size(width: 10, height: 10)
// }
// }

container.backgroundColor = .yellow
container.configureFrame { maker in
maker.centerX()
maker.centerY(between: content1.nui_bottom, view.nui_bottom)
maker.top()
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions Framezilla.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
11FB41471D844F8F00700A40 /* MakerHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11FB41421D844F8F00700A40 /* MakerHelper.swift */; };
11FB41481D844F8F00700A40 /* UIView+Installer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11FB41431D844F8F00700A40 /* UIView+Installer.swift */; };
11FB41491D844F8F00700A40 /* UIView+Relations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11FB41441D844F8F00700A40 /* UIView+Relations.swift */; };
841192DD1FF205DC00AB255D /* ContainerInstallerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841192DC1FF205DC00AB255D /* ContainerInstallerTests.swift */; };
842BB7FC1F0638E9000D1CFF /* Parameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842BB7FB1F0638E9000D1CFF /* Parameters.swift */; };
8442F93E1EC75A8500B72551 /* BaseTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8442F9351EC75A8500B72551 /* BaseTest.swift */; };
8442F9401EC75A8500B72551 /* MakerBothSideRelationsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8442F9381EC75A8500B72551 /* MakerBothSideRelationsTests.swift */; };
Expand Down Expand Up @@ -51,6 +52,7 @@
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 /* ContainerInstallerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerInstallerTests.swift; sourceTree = "<group>"; };
842BB7FB1F0638E9000D1CFF /* Parameters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Parameters.swift; sourceTree = "<group>"; };
8442F9351EC75A8500B72551 /* BaseTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseTest.swift; sourceTree = "<group>"; };
8442F9361EC75A8500B72551 /* FramezillaTests-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FramezillaTests-Bridging-Header.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -138,6 +140,7 @@
84EDCC231F9B3AB10091FAB9 /* MakerSafeAreaTests.swift */,
8442F93D1EC75A8500B72551 /* StateTests.swift */,
845108061EE2F5BC006DC1C8 /* ScrollViewTests.swift */,
841192DC1FF205DC00AB255D /* ContainerInstallerTests.swift */,
);
path = Tests;
sourceTree = "<group>";
Expand Down Expand Up @@ -273,6 +276,7 @@
files = (
8442F9441EC75A8500B72551 /* MakerWidthHeightTests.swift in Sources */,
8442F9451EC75A8500B72551 /* StateTests.swift in Sources */,
841192DD1FF205DC00AB255D /* ContainerInstallerTests.swift in Sources */,
8442F9411EC75A8500B72551 /* MakerCenterTests.swift in Sources */,
8442F9421EC75A8500B72551 /* MakerStackTests.swift in Sources */,
8442F9401EC75A8500B72551 /* MakerBothSideRelationsTests.swift in Sources */,
Expand Down
Loading

0 comments on commit 2ba927c

Please sign in to comment.