Skip to content

Instantly share code, notes, and snippets.

@xmhafiz
Last active June 27, 2023 20:44
Show Gist options
  • Save xmhafiz/b4e218cd9f93f8bd86415208852b3b29 to your computer and use it in GitHub Desktop.
Save xmhafiz/b4e218cd9f93f8bd86415208852b3b29 to your computer and use it in GitHub Desktop.
BottomSheetViewController part 1
import UIKit
class BottomSheetViewController: UIViewController {
// MARK: - UI
/// Main bottom sheet container view
private lazy var mainContainerView: UIView = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
view.backgroundColor = .systemBackground
view.layer.cornerRadius = 8
view.clipsToBounds = true
return view
}()
/// View to to hold dynamic content
private lazy var contentView: UIView = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
/// Top bar view that draggable to dismiss
private lazy var topBarView: UIView = {
let view = UIView()
view.backgroundColor = .lightGray.withAlphaComponent(0.1)
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
/// Top bar line
private lazy var barLineView: UIView = {
let view = UIView()
view.backgroundColor = .lightGray
view.layer.cornerRadius = 3
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
/// Dimmed background view
private lazy var dimmedView: UIView = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
view.backgroundColor = .black
view.alpha = 0
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
// to be added
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment