Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomoya Hayakawa authored and Tomoya Hayakawa committed Mar 23, 2017
0 parents commit f3c9c4f
Show file tree
Hide file tree
Showing 59 changed files with 3,798 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

# Mac
.DS_Store

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xcuserstate

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.2
14 changes: 14 additions & 0 deletions AutoToggleHeaderFooterView.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Pod::Spec.new do |s|
s.name = 'AutoToggleHeaderFooterView'
s.version = '1.0.0'
s.summary = 'A header and footer toggle display-state depending on the scroll or time interval'
s.homepage = 'https://github.com/recruit-lifestyle/AutoToggleHeaderFooterView'
s.license = 'Apache License, Version 2.0'
s.author = { 'Tomoya Hayakawa' => 'rhd_internship_ER5@r.recruit.co.jp' }
s.source = { :git => 'https://github.com/recruit-lifestyle/AutoToggleHeaderFooterView.git', :tag => s.version.to_s }

s.ios.deployment_target = '8.0'
s.platform = :ios, '8.0'

s.source_files = 'AutoToggleHeaderFooterView/Classes/**/*'
end
53 changes: 53 additions & 0 deletions AutoToggleHeaderFooterView/Classes/Constraint.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// Constraint.swift
// Pods
//
// Created by Tomoya Hayakawa on 2017/03/01.
// Copyright (c) 2017 RECRUIT LIFESTYLE CO., LTD. All rights reserved.
//

import UIKit

struct Constraint {
static func make(_ view1: Any, _ attr1: NSLayoutAttribute, _ relation: NSLayoutRelation, to view2: Any?, _ attr2: NSLayoutAttribute, multiplier: CGFloat = 1.0, constant c: CGFloat = 0, priority: UILayoutPriority? = nil) -> NSLayoutConstraint {
let constraint = NSLayoutConstraint(item: view1, attribute: attr1, relatedBy: relation,
toItem: view2, attribute: attr2, multiplier: multiplier, constant: c)
if let priority = priority {
constraint.priority = priority
}

return constraint
}

static func make(_ view1: Any, edgesEqualTo view2: Any, multiplier: CGFloat = 1.0, priority: UILayoutPriority? = nil) -> [NSLayoutConstraint] {
let constraints = [
NSLayoutConstraint(item: view1, attribute: .top, relatedBy: .equal, toItem: view2, attribute: .top, multiplier: multiplier, constant: 0),
NSLayoutConstraint(item: view1, attribute: .left, relatedBy: .equal, toItem: view2, attribute: .left, multiplier: multiplier, constant: 0),
NSLayoutConstraint(item: view1, attribute: .bottom, relatedBy: .equal, toItem: view2, attribute: .bottom, multiplier: multiplier, constant: 0),
NSLayoutConstraint(item: view1, attribute: .right, relatedBy: .equal, toItem: view2, attribute: .right, multiplier: multiplier, constant: 0)
]
if let priority = priority {
constraints.forEach { $0.priority = priority }
}

return constraints
}

static func make(_ view: Any, width relation: NSLayoutRelation, to constant: CGFloat, priority: UILayoutPriority? = nil) -> NSLayoutConstraint {
let constraint = NSLayoutConstraint(item: view, attribute: .width, relatedBy: relation, toItem: nil, attribute: .width, multiplier: 1.0, constant: constant)
if let priority = priority {
constraint.priority = priority
}

return constraint
}

static func make(_ view: Any, height relation: NSLayoutRelation, to constant: CGFloat, priority: UILayoutPriority? = nil) -> NSLayoutConstraint {
let constraint = NSLayoutConstraint(item: view, attribute: .height, relatedBy: relation, toItem: nil, attribute: .height, multiplier: 1.0, constant: constant)
if let priority = priority {
constraint.priority = priority
}

return constraint
}
}
Loading

0 comments on commit f3c9c4f

Please sign in to comment.