Skip to content

Commit

Permalink
-Minor Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mspvirajpatel committed Aug 30, 2017
1 parent dfef40e commit d705612
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 94 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions Example/SwiftyBase/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
Expand All @@ -11,7 +16,7 @@
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 CocoaPods. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2017 Viraj Patel. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
Expand All @@ -24,7 +29,7 @@
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
Expand Down
10 changes: 8 additions & 2 deletions Example/SwiftyBase/Controller/ListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ class ListController: BaseViewController {
}

required init(iView: BaseView) {
fatalError("init(iView:) has not been implemented")
listView = ListView(frame: CGRect.zero)
super.init(iView: listView, andNavigationTitle: "List")
self.loadViewControls()
self.setViewlayout()
}

required init(iView: BaseView, andNavigationTitle titleString: String) {
fatalError("init(iView:andNavigationTitle:) has not been implemented")
listView = ListView(frame: CGRect.zero)
super.init(iView: listView, andNavigationTitle: "List")
self.loadViewControls()
self.setViewlayout()
}

override func viewDidLoad() {
Expand Down
53 changes: 7 additions & 46 deletions Example/SwiftyBase/Controller/ListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class ListView: BaseView,UITableViewDataSource, UITableViewDelegate{

// MARK: - Attributes -

var testView : UIView!

var personListTableView : UITableView!

// MARK: - Lifecycle -
Expand Down Expand Up @@ -45,16 +43,10 @@ class ListView: BaseView,UITableViewDataSource, UITableViewDelegate{
override func loadViewControls(){
super.loadViewControls()

testView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: Int(UIScreen.main.bounds.width), height: 200))

//testView.translatesAutoresizingMaskIntoConstraints = false
testView.backgroundColor = UIColor.red
testView.layer.setValue("testView", forKey: ControlConstant.name)
self.addSubview(testView)


personListTableView = UITableView(frame: CGRect.zero, style: .grouped)
personListTableView = UITableView(frame: CGRect.zero, style: .plain)
personListTableView.translatesAutoresizingMaskIntoConstraints = false

//must required for self.getDictionaryOfVariableBindings funcation Used
personListTableView.layer.setValue("personListTableView", forKey: ControlConstant.name)

personListTableView.register(UITableViewCell.self, forCellReuseIdentifier: CellIdentifire.defaultCell)
Expand Down Expand Up @@ -93,44 +85,16 @@ class ListView: BaseView,UITableViewDataSource, UITableViewDelegate{

baseLayout.control_H = NSLayoutConstraint.constraints(withVisualFormat: "H:|[personListTableView]|", options:NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: baseLayout.viewDictionary)

baseLayout.control_V = NSLayoutConstraint.constraints(withVisualFormat: "V:|-[testView]-[personListTableView]-|", options:[.alignAllLeading , .alignAllTrailing], metrics: nil, views: baseLayout.viewDictionary)
baseLayout.control_V = NSLayoutConstraint.constraints(withVisualFormat: "V:|[personListTableView]|", options:[.alignAllLeading , .alignAllTrailing], metrics: nil, views: baseLayout.viewDictionary)

self.addConstraints(baseLayout.control_H)
self.addConstraints(baseLayout.control_V)

generateDiagonal(view: testView)


self.layoutSubviews()



// baseLayout.expandView(personListTableView, insideView: self)

}

func generateDiagonal(view: UIView?) {
let maskLayer : CAShapeLayer = CAShapeLayer()
maskLayer.fillRule = kCAFillRuleEvenOdd
maskLayer.frame = (view?.bounds)!

UIGraphicsBeginImageContext((view?.bounds.size)!);
let path = UIBezierPath()

path.move(to: CGPoint.init(x: 0, y: 0))
path.addLine(to: CGPoint.init(x: (view?.bounds.size.width)!, y: 0))


path.addLine(to: CGPoint.init(x: (view?.bounds.size.width)!, y: (view?.bounds.size.height)! / 2))

path.addLine(to: CGPoint.init(x: 0, y: (view?.bounds.size.height)!))

path.close()
path.fill()

maskLayer.path = path.cgPath;
UIGraphicsEndImageContext();
view!.layer.mask = maskLayer;
}

// MARK: - Public Interface -

Expand All @@ -146,12 +110,9 @@ class ListView: BaseView,UITableViewDataSource, UITableViewDelegate{

// MARK: - UITableView DataSource Methods -

func numberOfSections(in tableView: UITableView) -> Int {
return 1
}


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return 0
return 25

}

Expand Down
20 changes: 10 additions & 10 deletions SwiftyBase/Classes/Utility/AppBaseLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ open class AppBaseLayout: NSObject {
}


open func expandViewInsideView(_ mainView: UIView){

let dictionary: Dictionary! = ["view" : view]

self.control_H = NSLayoutConstraint.constraints(withVisualFormat: "H:|[view]|", options:NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: dictionary)
self.control_V = NSLayoutConstraint.constraints(withVisualFormat: "V:|[view]|", options:NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: dictionary)

mainView.addConstraints(self.control_H)
mainView.addConstraints(self.control_V)
}
// open func expandViewInsideView(_ mainView: UIView){
//
// let dictionary: Dictionary! = ["view" : view]
//
// self.control_H = NSLayoutConstraint.constraints(withVisualFormat: "H:|[view]|", options:NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: dictionary)
// self.control_V = NSLayoutConstraint.constraints(withVisualFormat: "V:|[view]|", options:NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: dictionary)
//
// mainView.addConstraints(self.control_H)
// mainView.addConstraints(self.control_V)
// }

open func expandView(_ containerView: UIView, insideView mainView: UIView){

Expand Down
2 changes: 1 addition & 1 deletion SwiftyBase/Classes/Utility/AppTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public extension Color{
break

case .navigationTitle: // This will use for set navigation title color
instanceColor = UIColor(rgbValue: 0xffffff, alpha: 1.0)
instanceColor = UIColor(rgbValue: 0x000000, alpha: 1.0)
break

case .navigationBottomBorder:
Expand Down
55 changes: 25 additions & 30 deletions SwiftyBase/Classes/View/BaseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,29 +203,26 @@ open class BaseView: UIView {
/**
This is will check the TextControl is first in its SuperView
*/
open class func isFirstTextControlInSuperview(_ superview: UIView?, textControl: UIView) -> Bool{
open class func isFirstTextControlInSuperview(_ superview: UIView, textControl: UIView) -> Bool{

var isFirstTextControl : Bool = true

var textControlIndex : Int = -1
var viewControlIndex : Int = -1

if((superview.subviews.contains(textControl))){
textControlIndex = superview.subviews.index(of: textControl)!
}

if(superview != nil){

if((superview?.subviews.contains(textControl))!){
textControlIndex = superview!.subviews.index(of: textControl)!
}
for view in (superview.subviews) {

for view in (superview?.subviews)! {
if(view.isTextControl() && textControl != view){

if(view.isTextControl() && textControl != view){

viewControlIndex = superview!.subviews.index(of: view)!

if(viewControlIndex < textControlIndex){
isFirstTextControl = false
break
}
viewControlIndex = superview.subviews.index(of: view)!

if(viewControlIndex < textControlIndex){
isFirstTextControl = false
break
}
}
}
Expand All @@ -237,32 +234,30 @@ open class BaseView: UIView {
/**
This is will check the TextControl is last in its SuperView
*/
open class func isLastTextControlInSuperview(_ superview: UIView?, textControl: UIView) -> Bool{
open class func isLastTextControlInSuperview(_ superview: UIView, textControl: UIView) -> Bool{

var isLastTextControl : Bool = true

var textControlIndex : Int = -1
var viewControlIndex : Int = -1

if((superview.subviews.contains(textControl))){
textControlIndex = superview.subviews.index(of: textControl)!
}

if(superview != nil){
for view in (superview.subviews) {

if((superview?.subviews.contains(textControl))!){
textControlIndex = superview!.subviews.index(of: textControl)!
}

for view in (superview?.subviews)! {
if(view.isTextControl() && textControl != view){

if(view.isTextControl() && textControl != view){

viewControlIndex = superview!.subviews.index(of: view)!

if(viewControlIndex > textControlIndex){
isLastTextControl = false
break
}
viewControlIndex = superview.subviews.index(of: view)!

if(viewControlIndex > textControlIndex){
isLastTextControl = false
break
}
}
}

return isLastTextControl
}

Expand Down

0 comments on commit d705612

Please sign in to comment.