Created
March 3, 2019 12:40
-
-
Save folivi/ab2953463f218f8169342cfbc2119826 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NewsFeedVM-extension.swift | |
// Bayello | |
// | |
// Created by Aboussa Folivi FOLLY on 01/03/2019. | |
// Copyright © 2019 Aboussa Folivi FOLLY. All rights reserved. | |
// | |
import Foundation | |
import UIKit | |
extension NewsFeedVM { | |
func addScrollView(){ | |
addSubview(_scrollView) | |
_scrollView.bounces = false | |
} | |
func addScroller(){ | |
scroller.alpha = 0.5 | |
_scrollView.addSubview(scroller) | |
} | |
func applyConstraints(){ | |
NSLayoutConstraint.activate([ | |
_scrollView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor), | |
_scrollView.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor), | |
_scrollView.leadingAnchor.constraint(equalTo: leadingAnchor), | |
_scrollView.trailingAnchor.constraint(equalTo: trailingAnchor), | |
// _scrollView.heightAnchor.constraint(equalToConstant: 1200), | |
scroller.topAnchor.constraint(equalTo: _scrollView.topAnchor), | |
scroller.bottomAnchor.constraint(equalTo: _scrollView.bottomAnchor), | |
scroller.leadingAnchor.constraint(equalTo: _scrollView.leadingAnchor), | |
scroller.trailingAnchor.constraint(equalTo: _scrollView.trailingAnchor), | |
scroller.centerXAnchor.constraint(equalTo: _scrollView.centerXAnchor), | |
scroller.heightAnchor.constraint(equalToConstant: 1200), | |
]) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NewsFeedVM.swift | |
// Bayello | |
// | |
// Created by Aboussa Folivi FOLLY on 12/02/2019. | |
// Copyright © 2019 Aboussa Folivi FOLLY. All rights reserved. | |
// | |
import UIKit | |
import FontAwesome_swift | |
class NewsFeedVM: UIView{ | |
lazy var _scrollView: UIScrollView = { | |
let _scv = UIScrollView() | |
_scv.translatesAutoresizingMaskIntoConstraints = false | |
_scv.contentSize.height = 1200 | |
return _scv | |
}() | |
lazy var scroller: UIView = { | |
createView() | |
}() | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
backgroundColor = #colorLiteral(red: 0.9452448487, green: 0.9422780871, blue: 0.947571218, alpha: 1) | |
setupSubviews() | |
} | |
fileprivate func setupSubviews(){ | |
addScrollView() | |
addScroller() | |
applyConstraints() | |
} | |
required init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment