Skip to content

Instantly share code, notes, and snippets.

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

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 {