Skip to content
Permalink
Browse files
change
  • Loading branch information
Vinayak Sareen authored and Vinayak Sareen committed Aug 14, 2019
1 parent 5d32244 commit b4f4f85f6121466110c129c7a0a2639fe928d62d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 24 deletions.

Some generated files are not rendered by default. Learn more.

@@ -10,7 +10,8 @@ import UIKit
import SVSwiper

class ViewController: UIViewController {



override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
@@ -25,7 +26,7 @@ class ViewController: UIViewController {
self.addChildViewController(controller)
guard let cview = controller.view else { return }
view.addSubview(cview)
cview.fillSuperView()
cview.svFillSuperView()
}

}
@@ -41,11 +42,11 @@ extension ViewController: SVSwiperDelegate{
}

func barColor() -> UIColor {
return #colorLiteral(red: 0.2392156869, green: 0.6745098233, blue: 0.9686274529, alpha: 1)
return #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
}

func textColor() -> UIColor {
return #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
return #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
}

func titleTextColor() -> UIColor {
@@ -21,22 +21,22 @@ Pod::Spec.new do |s|
TODO: Add long description of the pod here.
DESC

s.homepage = 'https://github.com/buggyman026@gmail.com/SVSwiper'
s.homepage = 'https://github.coventry.ac.uk/sareenv/SVSwiper'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'buggyman026@gmail.com' => 'sareenv@uni.coventry.ac.uk' }
s.source = { :git => 'https://github.com/buggyman026@gmail.com/SVSwiper.git', :tag => s.version.to_s }
s.author = { 'Vinayak' => 'sareenv@uni.coventry.ac.uk' }
s.source = { :git => 'https://github.coventry.ac.uk/sareenv/SVSwiper.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

s.ios.deployment_target = '8.0'

s.source_files = 'SVSwiper/Classes/**/*'
s.source_files = 'SVSwiper/Classes/*.swift'

# s.resource_bundles = {
# 'SVSwiper' => ['SVSwiper/Assets/*.png']
# }

# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
s.frameworks = 'UIKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
@@ -12,7 +12,7 @@ import UIKit

public extension UIView{
@available(iOS 9.0, *)
func fillSuperView (top: CGFloat=0, bottom: CGFloat=0, leading: CGFloat=0, trailing: CGFloat=0){
func svFillSuperView (top: CGFloat=0, bottom: CGFloat=0, leading: CGFloat=0, trailing: CGFloat=0){
self.translatesAutoresizingMaskIntoConstraints = false
guard let superView = self.superview else { return }
self.topAnchor.constraint(equalTo: superView.topAnchor, constant: top).isActive = true
@@ -21,12 +21,24 @@ public extension UIView{
self.trailingAnchor.constraint(equalTo: superView.trailingAnchor, constant: trailing).isActive = true
}
@available(iOS 9.0, *)
func anchor(topAnchor: NSLayoutYAxisAnchor, bottomAnchor: NSLayoutYAxisAnchor, leadingAnchor: NSLayoutXAxisAnchor, trailingAnchor: NSLayoutXAxisAnchor, padding: UIEdgeInsets = .zero){
func svAnchor(topAnchor: NSLayoutYAxisAnchor?, bottomAnchor: NSLayoutYAxisAnchor?, leadingAnchor: NSLayoutXAxisAnchor?, trailingAnchor: NSLayoutXAxisAnchor?, padding: UIEdgeInsets = .zero){
self.translatesAutoresizingMaskIntoConstraints = false
self.topAnchor.constraint(equalTo: topAnchor, constant: padding.top)
self.bottomAnchor.constraint(equalTo: bottomAnchor, constant: padding.bottom)
self.leadingAnchor.constraint(equalTo: leadingAnchor, constant: padding.left)
self.trailingAnchor.constraint(equalTo: trailingAnchor, constant: padding.right)

if let topAnchor = topAnchor{
self.topAnchor.constraint(equalTo: topAnchor, constant: padding.top)
}

if let bottomAnchor = bottomAnchor{
self.bottomAnchor.constraint(equalTo: bottomAnchor, constant: padding.bottom)
}

if let leadingAnchor = leadingAnchor{
self.leadingAnchor.constraint(equalTo: leadingAnchor, constant: padding.left)
}

if let trailingAnchor = trailingAnchor{
self.trailingAnchor.constraint(equalTo: trailingAnchor, constant: padding.right)
}
}

}
@@ -75,7 +75,7 @@ public class SVSwiperController: UICollectionViewController, UICollectionViewDel
view.addSubview(headerCell)

if #available(iOS 9.0, *) {
headerCell.anchor(topAnchor: view.topAnchor, bottomAnchor: view.bottomAnchor, leadingAnchor: view.leadingAnchor, trailingAnchor: view.trailingAnchor)
headerCell.svAnchor(topAnchor: view.topAnchor, bottomAnchor: view.bottomAnchor, leadingAnchor: view.leadingAnchor, trailingAnchor: view.trailingAnchor)
headerCell.widthAnchor.constraint(equalToConstant: menuBarSize?.width ?? view?.frame.width ?? 0).isActive = true
headerCell.heightAnchor.constraint(equalToConstant: menuBarSize?.height ?? 0).isActive = true // change this
}
@@ -114,7 +114,7 @@ public class SVSwiperController: UICollectionViewController, UICollectionViewDel
stackView.alignment = .center
stackView.axis = .horizontal
self.headerCell.addSubview(stackView)
stackView.fillSuperView()
stackView.svFillSuperView()
}


@@ -26,7 +26,7 @@ class SVSwiperCustomCell: UICollectionViewCell{
guard let childView = viewController.view else { return }
self.addSubview(childView)
if #available(iOS 9.0, *) {
childView.fillSuperView(top: 5)
childView.svFillSuperView(top: 5)
}
}

@@ -36,3 +36,4 @@ class SVSwiperCustomCell: UICollectionViewCell{
super.init(coder: aDecoder)
}
}

0 comments on commit b4f4f85

Please sign in to comment.