Created
December 3, 2018 09:27
-
-
Save ryanmcgrath/61a1d5f28d93ce6042a2442097a38ce3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class HolidayCalendarCollectionViewItem: NSCollectionViewItem { | |
var leftAnchor: NSLayoutConstraint? | |
var initialTouchOne: NSTouch? | |
var initialTouchTwo: NSTouch? | |
var currentTouchOne: NSTouch? | |
var currentTouchTwo: NSTouch? | |
var initialPoint: CGPoint? | |
var isTracking = false | |
public lazy var contentView: NSView = { | |
let view = NSView(frame: .zero) | |
view.translatesAutoresizingMaskIntoConstraints = false | |
return view | |
}() | |
override func loadView() { | |
let itemView = NSView(frame: .zero) | |
itemView.postsFrameChangedNotifications = false | |
itemView.postsBoundsChangedNotifications = false | |
itemView.wantsLayer = true | |
itemView.allowedTouchTypes = [.direct, .indirect] | |
itemView.addSubview(contentView) | |
leftAnchor = contentView.leftAnchor.constraint(equalTo: itemView.leftAnchor) | |
NSLayoutConstraint.activate([ | |
contentView.topAnchor.constraint(equalTo: itemView.topAnchor), | |
leftAnchor!, | |
contentView.bottomAnchor.constraint(equalTo: itemView.bottomAnchor), | |
contentView.widthAnchor.constraint(equalTo: itemView.widthAnchor), | |
]) | |
view = itemView | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment