Skip to content

Instantly share code, notes, and snippets.

vgorloff / Compress.swift
Created Jul 14, 2021
View Compress.swift
let data = "HelloZip!".data(using: .utf8)!
let compressedData = (data as NSData).compressed(using: .zlib) as Data
let compressedDataAsBase64EncodedString = compressedData.base64EncodedString()
// Prints: 80jNycmPyixQBAA=
vgorloff /
Last active Jul 1, 2021
Deleted SO question: NSTextView: Visually indent wrapped lines (aka IDE editor) without modifying text storage attributes.

Say I have NSTextView and custom NSRulerView:

[![enter image description here][1]][1]

Now I want every wrapped line to indent say on 3 spaces (like on image below).

[![enter image description here][2]][2]

How to achieve it without modifying text storage attributes (i.e. Paragraph style)? Should I use NSLayoutManager? Thanks!

View so.CoreData.observeEntityChangesViaNotifications.swift
//: [Previous](@previous)
import PlaygroundSupport
import Cocoa
import CoreData
PlaygroundPage.current.needsIndefiniteExecution = true
extension NSManagedObject {