Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pin.readableMargins and pin.layoutmargins #170

Merged
merged 5 commits into from
Aug 25, 2018
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
56 changes: 46 additions & 10 deletions Example/PinLayoutSample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@
DF4C1AA4205AEDFC00DED50B /* SafeAreaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF4C1AA0205AEDFC00DED50B /* SafeAreaView.swift */; };
DF4C1AA5205AEDFC00DED50B /* SafeAreaViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF4C1AA1205AEDFC00DED50B /* SafeAreaViewController.swift */; };
DF4C1AAA205AF10900DED50B /* RoundedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF4C1AA7205AF10900DED50B /* RoundedButton.swift */; };
DF4C1AAE205AF78A00DED50B /* SafeAreaCornersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF4C1AAC205AF78A00DED50B /* SafeAreaCornersViewController.swift */; };
DF4C1AAF205AF78A00DED50B /* SafeAreaCornersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF4C1AAD205AF78A00DED50B /* SafeAreaCornersView.swift */; };
DF4C1AAE205AF78A00DED50B /* SafeAreaAndMarginsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF4C1AAC205AF78A00DED50B /* SafeAreaAndMarginsViewController.swift */; };
DF4C1AAF205AF78A00DED50B /* SafeAreaAndMarginsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF4C1AAD205AF78A00DED50B /* SafeAreaAndMarginsView.swift */; };
DFBCAEFB213012930025F7BF /* MethodReadableInsetsGroupHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBCAEF9213012930025F7BF /* MethodReadableInsetsGroupHeader.swift */; };
DFBCAEFC213012930025F7BF /* MethodReadableInsetsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBCAEFA213012930025F7BF /* MethodReadableInsetsCell.swift */; };
DFBCAEFE2130146C0025F7BF /* AreaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBCAEFD2130146C0025F7BF /* AreaView.swift */; };
DFD27841211B1A710056BD93 /* UINavigationController+Orientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD27840211B1A700056BD93 /* UINavigationController+Orientation.swift */; };
DFD27848211B1D090056BD93 /* UITabBarController+Orientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD27847211B1D090056BD93 /* UITabBarController+Orientation.swift */; };
DFD31BA0212EE4F200566CA4 /* TableViewReadableContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD31B9E212EE4F100566CA4 /* TableViewReadableContentView.swift */; };
DFD31BA1212EE4F200566CA4 /* TableViewReadableContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD31B9F212EE4F200566CA4 /* TableViewReadableContentViewController.swift */; };
DFEAF74A20C9648A00E33147 /* WrapContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFEAF74920C9648A00E33147 /* WrapContentView.swift */; };
DFEAF74C20C9649F00E33147 /* WrapContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFEAF74B20C9649F00E33147 /* WrapContentViewController.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -183,10 +188,15 @@
DF4C1AA0205AEDFC00DED50B /* SafeAreaView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SafeAreaView.swift; sourceTree = "<group>"; };
DF4C1AA1205AEDFC00DED50B /* SafeAreaViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SafeAreaViewController.swift; sourceTree = "<group>"; };
DF4C1AA7205AF10900DED50B /* RoundedButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoundedButton.swift; sourceTree = "<group>"; };
DF4C1AAC205AF78A00DED50B /* SafeAreaCornersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SafeAreaCornersViewController.swift; sourceTree = "<group>"; };
DF4C1AAD205AF78A00DED50B /* SafeAreaCornersView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SafeAreaCornersView.swift; sourceTree = "<group>"; };
DF4C1AAC205AF78A00DED50B /* SafeAreaAndMarginsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SafeAreaAndMarginsViewController.swift; sourceTree = "<group>"; };
DF4C1AAD205AF78A00DED50B /* SafeAreaAndMarginsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SafeAreaAndMarginsView.swift; sourceTree = "<group>"; };
DFBCAEF9213012930025F7BF /* MethodReadableInsetsGroupHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MethodReadableInsetsGroupHeader.swift; sourceTree = "<group>"; };
DFBCAEFA213012930025F7BF /* MethodReadableInsetsCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MethodReadableInsetsCell.swift; sourceTree = "<group>"; };
DFBCAEFD2130146C0025F7BF /* AreaView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AreaView.swift; sourceTree = "<group>"; };
DFD27840211B1A700056BD93 /* UINavigationController+Orientation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Orientation.swift"; sourceTree = "<group>"; };
DFD27847211B1D090056BD93 /* UITabBarController+Orientation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBarController+Orientation.swift"; sourceTree = "<group>"; };
DFD31B9E212EE4F100566CA4 /* TableViewReadableContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewReadableContentView.swift; sourceTree = "<group>"; };
DFD31B9F212EE4F200566CA4 /* TableViewReadableContentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewReadableContentViewController.swift; sourceTree = "<group>"; };
DFEAF74920C9648A00E33147 /* WrapContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WrapContentView.swift; sourceTree = "<group>"; };
DFEAF74B20C9649F00E33147 /* WrapContentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WrapContentViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -258,11 +268,12 @@
DF4C1A9F205AEDFC00DED50B /* SafeArea */,
DFEAF71520C840F300E33147 /* WrapContent */,
DF3908912118FFF20049FD56 /* Animations */,
2439CC631E66606D003326FB /* RelativeView */,
2439CC5F1E665F66003326FB /* MultiRelativeView */,
2497CFEA1EF40B8100DFD13B /* Form */,
DFD31B9D212EE4D600566CA4 /* TableViewReadableContent */,
24D18D181F3DECD6008129EF /* IntroRTL */,
2416376F1F8E4BC200EE703A /* IntroObjectiveC */,
2439CC5F1E665F66003326FB /* MultiRelativeView */,
2439CC631E66606D003326FB /* RelativeView */,
24CD1E8D1F8E4B0A00C3A54D /* PinLayoutSample-Bridging-Header.h */,
);
path = Examples;
Expand Down Expand Up @@ -437,15 +448,16 @@
DF4C1AAB205AF10C00DED50B /* Subviews */,
DF4C1AA0205AEDFC00DED50B /* SafeAreaView.swift */,
DF4C1AA1205AEDFC00DED50B /* SafeAreaViewController.swift */,
DF4C1AAD205AF78A00DED50B /* SafeAreaCornersView.swift */,
DF4C1AAC205AF78A00DED50B /* SafeAreaCornersViewController.swift */,
DF4C1AAD205AF78A00DED50B /* SafeAreaAndMarginsView.swift */,
DF4C1AAC205AF78A00DED50B /* SafeAreaAndMarginsViewController.swift */,
);
path = SafeArea;
sourceTree = "<group>";
};
DF4C1AAB205AF10C00DED50B /* Subviews */ = {
isa = PBXGroup;
children = (
DFBCAEFD2130146C0025F7BF /* AreaView.swift */,
DF4C1AA7205AF10900DED50B /* RoundedButton.swift */,
);
path = Subviews;
Expand All @@ -460,6 +472,25 @@
path = AutoAdjustingSize;
sourceTree = "<group>";
};
DFBCAEF82130127F0025F7BF /* Cells */ = {
isa = PBXGroup;
children = (
DFBCAEF9213012930025F7BF /* MethodReadableInsetsGroupHeader.swift */,
DFBCAEFA213012930025F7BF /* MethodReadableInsetsCell.swift */,
);
path = Cells;
sourceTree = "<group>";
};
DFD31B9D212EE4D600566CA4 /* TableViewReadableContent */ = {
isa = PBXGroup;
children = (
DFBCAEF82130127F0025F7BF /* Cells */,
DFD31B9E212EE4F100566CA4 /* TableViewReadableContentView.swift */,
DFD31B9F212EE4F200566CA4 /* TableViewReadableContentViewController.swift */,
);
path = TableViewReadableContent;
sourceTree = "<group>";
};
DFEAF71520C840F300E33147 /* WrapContent */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -661,8 +692,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DF4C1AAF205AF78A00DED50B /* SafeAreaCornersView.swift in Sources */,
DF4C1AAF205AF78A00DED50B /* SafeAreaAndMarginsView.swift in Sources */,
24F246141FA8D57100B6332E /* UIImageView+Download.swift in Sources */,
DFBCAEFC213012930025F7BF /* MethodReadableInsetsCell.swift in Sources */,
24DA374B1EF7F90600D1AB2F /* BaseFormView.swift in Sources */,
24F75B5C1EE5644E008DB567 /* IntroViewController.swift in Sources */,
241637741F8E4BC200EE703A /* IntroObjectiveCViewController.m in Sources */,
Expand All @@ -673,9 +705,10 @@
24D18D1E1F3DED0D008129EF /* IntroRTLViewController.swift in Sources */,
DFEAF74C20C9649F00E33147 /* WrapContentViewController.swift in Sources */,
24F246121FA8D4D100B6332E /* HouseCell.swift in Sources */,
DF4C1AAE205AF78A00DED50B /* SafeAreaCornersViewController.swift in Sources */,
DF4C1AAE205AF78A00DED50B /* SafeAreaAndMarginsViewController.swift in Sources */,
24A9C2031EF16A3E00F2CF64 /* AutoAdjustingSizeView.swift in Sources */,
DFD27848211B1D090056BD93 /* UITabBarController+Orientation.swift in Sources */,
DFBCAEFE2130146C0025F7BF /* AreaView.swift in Sources */,
24D18D1D1F3DED0D008129EF /* IntroRTLView.swift in Sources */,
DF4C1AAA205AF10900DED50B /* RoundedButton.swift in Sources */,
2439CC351E665BF6003326FB /* MenuView.swift in Sources */,
Expand All @@ -689,6 +722,8 @@
DF4C1AA5205AEDFC00DED50B /* SafeAreaViewController.swift in Sources */,
DFEAF74A20C9648A00E33147 /* WrapContentView.swift in Sources */,
249EFE431E64FAFE00165E39 /* AppDelegate.swift in Sources */,
DFD31BA1212EE4F200566CA4 /* TableViewReadableContentViewController.swift in Sources */,
DFBCAEFB213012930025F7BF /* MethodReadableInsetsGroupHeader.swift in Sources */,
2497CFEE1EF40B9100DFD13B /* FormViewController.swift in Sources */,
24A9C1F31EF0542F00F2CF64 /* TableViewExampleViewController.swift in Sources */,
24CB99981F290540004EA7FB /* MethodGroupHeader.swift in Sources */,
Expand All @@ -699,6 +734,7 @@
241637771F8E4F9100EE703A /* IntroObjectiveCView.m in Sources */,
24CB99A01F290664004EA7FB /* ChoiceSelectorView.swift in Sources */,
249326891EEEEE3D00BCB814 /* Stylesheet.swift in Sources */,
DFD31BA0212EE4F200566CA4 /* TableViewReadableContentView.swift in Sources */,
DF39089A211900480049FD56 /* AnimationsViewController.swift in Sources */,
2439CC521E665C6B003326FB /* MultiRelativeView.swift in Sources */,
24F246101FA8D4D100B6332E /* CollectionViewExampleView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AdjustToContainerViewController: UIViewController {
init(pageType: PageType) {
super.init(nibName: nil, bundle: nil)

title = pageType.text
title = pageType.title
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AnimationsViewController: UIViewController {
init(pageType: PageType) {
super.init(nibName: nil, bundle: nil)

title = pageType.text
title = pageType.title
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AutoAdjustingSizeViewController: UIViewController {
init(pageType: PageType) {
super.init(nibName: nil, bundle: nil)

title = pageType.text
title = pageType.title
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CollectionViewExampleViewController: UIViewController {
init(pageType: PageType) {
super.init(nibName: nil, bundle: nil)

title = pageType.text
title = pageType.title

// This property is used only on iOS 7/8/9/10. See https://developer.apple.com/documentation/uikit/uiviewcontroller/1621372-automaticallyadjustsscrollviewin
automaticallyAdjustsScrollViewInsets = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FormViewController: UIViewController {
init(pageType: PageType) {
super.init(nibName: nil, bundle: nil)

title = pageType.text
title = pageType.title
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class IntroViewController: UIViewController {
init(pageType: PageType) {
super.init(nibName: nil, bundle: nil)

title = pageType.text
title = pageType.title
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class IntroRTLViewController: UIViewController {
init(pageType: PageType) {
super.init(nibName: nil, bundle: nil)

title = pageType.text
title = pageType.title
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MultiRelativeViewController: UIViewController {
init(pageType: PageType) {
super.init(nibName: nil, bundle: nil)

title = pageType.text
title = pageType.title
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RelativeViewController: UIViewController {
init(pageType: PageType) {
super.init(nibName: nil, bundle: nil)

title = pageType.text
title = pageType.title
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright (c) 2017 Luc Dion
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import UIKit
import PinLayout

class SafeAreaAndMarginsView: UIView {
private let safeAreaView = AreaView(name: "pin.safeArea",
color: UIColor(red: 0.02, green: 0.20, blue: 0.29, alpha: 1))
private let layoutMarginsAreaView = AreaView(name: "pin.layoutMargins",
color: UIColor(red: 0.1, green: 0.49, blue: 0.58, alpha: 1))
private let readableMarginsView = AreaView(name: " pin.readableMargins",
color: UIColor(red: 0.15, green: 0.60, blue: 0.89, alpha: 1))

init() {
super.init(frame: .zero)
backgroundColor = .white

addSubview(safeAreaView)
addSubview(layoutMarginsAreaView)
addSubview(readableMarginsView)
}

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}

override func safeAreaInsetsDidChange() {
if #available(iOS 11.0, *) {
super.safeAreaInsetsDidChange()
}
}

override func layoutSubviews() {
super.layoutSubviews()

safeAreaView.pin.all(pin.safeArea)
layoutMarginsAreaView.pin.all(pin.layoutMargins)
readableMarginsView.pin.all(pin.readableMargins)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,22 @@

import UIKit

class SafeAreaCornersViewController: UIViewController {
private var mainView: SafeAreaCornersView {
return self.view as! SafeAreaCornersView
class SafeAreaAndMarginsViewController: UIViewController {
private var mainView: SafeAreaAndMarginsView {
return self.view as! SafeAreaAndMarginsView
}

init() {
super.init(nibName: nil, bundle: nil)

title = "SafeArea Corners"
tabBarItem = UITabBarItem(title: "SafeArea Corners", image: UIImage(named: "Tab2"), tag: 0)
tabBarItem = UITabBarItem(title: "Layout areas", image: UIImage(named: "Tab2"), tag: 0)
}

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}

override func loadView() {
view = SafeAreaCornersView()
view = SafeAreaAndMarginsView()
}
}
Loading