Skip to content

Instantly share code, notes, and snippets.

View rorz's full-sized avatar
🌊
🌊

Rorz rorz

🌊
🌊
View GitHub Profile
@rorz
rorz / NSView+ChangeAnchorPointWithoutMakingTheLayerJump.swift
Last active June 17, 2018 00:51 — forked from aral/NSView+ChangeAnchorPointWithoutMakingTheLayerJump.swift
A replacement for the anchorPoint property that doesn’t make the layer jump. Swift 4+
//
// NSView+ChangeAnchorPointWithoutMakingTheLayerJump.swift
//
// Setting .anchorPoint on a layer makes the layer jump which is most
// likely not what you want. This extension fixes that. Useful for Core Animation.
//
// Usage: (e.g., to set the anchor point to the centre)
//
// myView.setAnchorPoint(CGPointMake(0.5, 0.5))
//