Swiftpack.co - ChimeHQ/ViewPlus as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ChimeHQ.
ChimeHQ/ViewPlus 1.2.0
Make working with NSView more pleasant
⭐️ 9
🕓 1 year ago
.package(url: "https://github.com/ChimeHQ/ViewPlus.git", from: "1.2.0")

Github CI Carthage compatible


ViewPlus is a small library that provides some helpful extension and capabilities for working with NSView.


Swift Package Manager

dependencies: [
    .package(url: "https://github.com/ChimeHQ/ViewPlus.git")


github "ChimeHQ/ViewPlus"



func removeTrackingArea(with rect: NSRect)
func removeTrackingAreas(_ areas: [NSTrackingArea])
func removeAllTrackingAreas()

Auto Layout

var useAutoLayout: Bool
var subviewsUseAutoLayout: Bool


func animateLayout(changes: (NSAnimationContext) -> Void)


func withPriority(_ p: NSLayoutConstraint.Priority) -> NSLayoutConstraint


func offset(by: Float) -> NSLayoutConstraint.Priority



By default, the layer property of an NSView has a number of restrictions. There are many properties that are owned and controlled by the AppKit, and are impossible to modify in a safe and predictable way. This class provides a single property unrestrictedLayer, which has no restrictions whatsoever.

This layer will just match the frame of the hosting view. This is is a great way to integrate a layer into the Auto Layout system. It's also nice for applying transforms.


A really simple view that will never become first responder due to a mouse down event. This is handy for routing clicks down into other parts of the view hierarchy.


This is a very simple NSViewController subclass that eliminates some boilerplate for view controllers that always create their views programatically. This class is based on work on a blog post about view controllers without XIBs, and includes a lot of great discussion about the pros and cons of such an approach.

Suggestions or Feedback

We'd love to hear from you! Get in touch via an issue or pull request.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.


Stars: 9
Last commit: 5 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

1 year ago
  • NoSelfHitTestingView class

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics