Skip to content

Instantly share code, notes, and snippets.

@davidinga
davidinga / GraphAM.swift
Last active March 6, 2022 04:21
Graph data structure in Swift using an Adjacency Matrix.
public struct GraphAM {
private var adjMatrix = [[Int?]]()
private var numberOfVertices: Int {
return adjMatrix.count
}
init(numberOfVertices: Int) {
adjMatrix = Array(repeating: Array(repeating: nil, count: numberOfVertices), count: numberOfVertices)
}
@Tokuriku
Tokuriku / Count lines of code in Xcode project
Last active June 30, 2024 21:09 — forked from ccabanero/Count lines of code in Xcode project
Count lines of code in SWIFT Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute the following when inside your target project:
find . -name "*.swift" -print0 | xargs -0 wc -l
@larryfox
larryfox / adjacency-list.swift
Last active March 6, 2022 04:21
Adjacency list in Swift
// Found this lying around in my code folder from when I was
// first playing with Swift. Consider it public domain.
struct Graph<T: Hashable> {
let directed: Bool
var adj = Dictionary<T, [T]>()
init(directed d: Bool) {
directed = d
}
@jacks205
jacks205 / VideoBlurBackground.swift
Last active September 18, 2020 08:58
Video Blur Background in Swift
//
// ViewController.swift
// citizencrossfit
//
// Created by Mark Jackson on 17/11/2014.
// Copyright (c) 2014 Mark Jackson. All rights reserved.
//
import UIKit
import Alamofire