Skip to content

Instantly share code, notes, and snippets.

How to Export Music from iPhone to Mac FREE (No iTunes, No Registration)

✅ Works on macOS Sonoma, Ventura, Monterey (Intel & Apple Silicon)
✅ Free & Open Source
✅ No jailbreak required


📦 Step 1. Install Required Tools via Homebrew

protocol MyDelegate: AnyObject {
func didFire(string: String)
}
final class AsyncDelegate<Element> {
let events: AsyncStream<Element>
let continuation: AsyncStream<Element>.Continuation
init(bufferPolicy: AsyncStream<Element>.Continuation.BufferingPolicy = .unbounded) {
(self.events, self.continuation) = AsyncStream<Element>.makeStream(
extension UITableView {
func updateTableHeaderView(with view: UIView?) {
guard
let view = view
else {
tableHeaderView = nil
return
}
let containerView = UIView()
containerView.translatesAutoresizingMaskIntoConstraints = false
extension Collection where Element: Collection {
func transposed() -> [[Element.Element]]? {
guard let maxCount = self.map({$0.count}).max() else {return nil}
var result = [[Element.Element?]](repeating: [Element.Element?](repeating: nil, count: self.count), count: maxCount)
for (r,row) in self.enumerated() {
for (c,v) in row.enumerated() {
result[c][r] = v
}
}
return result
import Foundation
protocol DelegateProtocol: class {
}
protocol Delegatable {
associatedtype DelegateType: DelegateProtocol
var delegate: DelegateType? { get set }
@t0rn
t0rn / Loop_LinkedList.swift
Created October 25, 2018 16:26
Loop in Linked List With Swift
import Foundation
class LinkedList<T> {
class Node<T> {
var value: T
var next: Node?
init (value: T){
self.value = value
}
import Foundation
/// A list is either empty or it is composed of a first element (head)
/// and a tail, which is a list itself.
///
/// See http://www.enekoalonso.com/projects/99-swift-problems/#linked-lists
class List<T> {
var value: T
var nextItem: List<T>?
let xs = [3,5,1,4,6,3,9,11,1,0,3]
let ys = ["t","e","a","z","o","v","p"]
extension Array where Element: Comparable {
func selectionSort() -> [Element] {
guard self.count > 1 else {return self}
var result = self
for index in (0..<count - 1) {
var indexLowest = index
extension Array where Element == Int {
var equilibriumIndexes: [Element]? {
var idxs = [Element]()
var sum = reduce(0,+)
var leftSum = 0
let count = self.count
for i in 0..<count {
sum = sum - self[i]
if leftSum == sum {
idxs.append(i)
@t0rn
t0rn / BalancedStrings.swift
Last active August 3, 2018 17:27
String extension for balancing by "open" and "close" substrings. String balanced algorithm using Swift
protocol StackProtocol {
associatedtype ElementType
var isEmpty: Bool { get }
mutating func pop() -> ElementType?
mutating func push(_ value: ElementType)
}