Skip to content

Instantly share code, notes, and snippets.

@mattgallagher
mattgallagher / AppDelegate.swift
Last active May 18, 2022 17:42
Animated circle views in SwiftUI and AppKit/CoreAnimation
//
// AppDelegate.swift
// SwiftUITestApp
//
// Created by Matt Gallagher on 4/6/24.
// Copyright © 2019 Matt Gallagher. All rights reserved.
//
import Cocoa
import SwiftUI
@onmyway133
onmyway133 / .gitignore
Last active October 27, 2021 16:25
AutoLayoutConverter - 🐜 Convert Cartography to NSLayoutAnchor
.DS_Store
.tags*
/.idea/
/build/
/dist/
/external_binaries/
/out/
/vendor/download/
/vendor/debian_jessie_amd64-sysroot/
/vendor/debian_jessie_arm-sysroot/
@lattner
lattner / TaskConcurrencyManifesto.md
Last active June 8, 2024 03:41
Swift Concurrency Manifesto
@skreutzberger
skreutzberger / sen_ios_swift_dev.md
Last active December 6, 2018 20:49
Senior iOS Swift Developer (Freelance, 100% Remote)

Senior iOS Swift Developer (Freelance, 100% Remote, EU)

I am searching experienced Swift freelancers for a disruptive, well-funded high-tech startup in the renewable energies sector located in Germany.

You will play a major role in making the world greener, the future brighter and energy distribution smarter by using latest technologies like server-side Swift, microservices, artificial intelligence and machine learning and new interfaces like chatbots, voice-only (Alexa, Google Home) and goal-driven dialog systems.

A substantial track record in open-source projects, a set of already released iOS apps on the App Store and a timezone difference of max 2 hours to Berlin local time are a must-have.

Your job:

  • build our chat-based iOS app and optionally later the Android app
@steipete
steipete / ios-xcode-device-support.sh
Last active December 12, 2023 03:36
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@nathanhillyer
nathanhillyer / .gitignore
Created May 12, 2016 16:26
Swift gitignore
#####
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
#
# This is complicated:
#
# SOMETIMES you need to put this file in version control.
# Apple designed it poorly - if you use "custom executables", they are
# saved in this file.
# 99% of projects do NOT use those, so they do NOT want to version control this file.
# ..but if you're in the 1%, comment out the line "*.pbxuser"
@IanKeen
IanKeen / IKScrollView.swift
Last active November 18, 2021 16:34
A UIScrollView subclass that allows you to use scrollviews and autolayout without the drama...
enum SizeMatching {
case Width, Height, Both, None
}
class IKScrollView: UIScrollView {
//MARK: - Outlets
@IBOutlet private var contentView: UIView?
//MARK: - Properties
@IBInspectable var sizeMatching = SizeMatching.Width
@IanKeen
IanKeen / DictionaryConvertable.swift
Last active August 3, 2017 16:18
Protocol to handle conversions between Models (class or struct based) and Dictionaries. Model to Dictionary has a default implementation provided for simple 1:1 Models
protocol DictionaryConvertable {
static func fromDictionary(dictionary: [String: AnyObject]) throws -> Self
func toDictionary() -> [String: AnyObject]
}
protocol DictionaryValueType {
func dictionaryValue() -> AnyObject?
}
extension Optional: DictionaryValueType {
func dictionaryValue() -> AnyObject? {
@IanKeen
IanKeen / KeyValueStorable.swift
Last active November 1, 2015 18:38
A protocol I like to use in my apps anywhere something like NSUserDefaults or KeyChain is normally used... allows for easy swapping of implementation. Also provided is StringDictionary() which can be used when testing
protocol KeyValueStorable {
subscript (key: String) -> AnyObject? { get set }
mutating func removeAll() -> Void
}
extension NSUserDefaults: KeyValueStorable {
subscript (key: String) -> AnyObject? {
get { return self.objectForKey(key) }
set { self.setObject(newValue, forKey: key) }
@plumhead
plumhead / StringSize.swift
Created September 15, 2015 13:34
String extension to find the layout size of a String with specified attributes.
extension String {
func size(withAttributes attrs: [String:AnyObject], constrainedTo box: NSSize) -> NSRect {
let storage = NSTextStorage(string: self)
let container = NSTextContainer(containerSize: NSSize(width: box.width, height: box.height))
let layout = NSLayoutManager()
layout.addTextContainer(container)
storage.addLayoutManager(layout)
storage.addAttributes(attrs, range: NSMakeRange(0, storage.length))
container.lineFragmentPadding = 0.0
let _ = layout.glyphRangeForTextContainer(container)