Skip to content

Instantly share code, notes, and snippets.

@minsOne
minsOne / Channel.swift
Created April 6, 2018 07:40 — forked from gokselkoksal/Channel.swift
Channel implementation
public class Channel<Value> {
private class Subscription {
weak var object: AnyObject?
private let notifyBlock: (Value) -> Void
private let queue: DispatchQueue
var isValid: Bool {
return object != nil
@minsOne
minsOne / NRLabel.swift
Created September 23, 2016 05:41 — forked from NikolaiRuhe/NRLabel.swift
A UILabel subclass that adds padding around the text and handles layout properly.
import UIKit
class NRLabel : UILabel {
var textInsets: UIEdgeInsets = UIEdgeInsetsZero {
didSet { invalidateIntrinsicContentSize() }
}
override func textRectForBounds(bounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect {
var rect = textInsets.apply(bounds)
@minsOne
minsOne / DragView.swift
Created August 17, 2016 16:29 — forked from fpg1503/DragView.swift
Drag and Drop View on macOS
protocol DragViewDelegate {
var acceptedFileExtensions: [String] { get }
func dragView(dragView: DragView, didDragFileWith URL: NSURL)
}
class DragView: NSView {
required init?(coder: NSCoder) {
super.init(coder: coder)
registerForDraggedTypes([NSFilenamesPboardType, NSURLPboardType])

Videos

@minsOne
minsOne / gist:aa3b4b0f071f72d5a58000abcac73e22
Created April 22, 2016 06:12 — forked from zetachang/gist:4111314
Instruction on adding a Acknowledgements Settings.bundle
  • To add Settings.bundle in Xcode. Command N and in Resource, choose Settings Bundle .
  • Open Root.plist in source code, paste the code below to replace it,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>PreferenceSpecifiers</key>