Skip to content

Instantly share code, notes, and snippets.

View commscheck's full-sized avatar

Benjamin Lea commscheck

View GitHub Profile
@commscheck
commscheck / .gitignore
Created May 9, 2020 02:29
Xcode .gitignore
# Xcode
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
**/xcshareddata/WorkspaceSettings.xcsettings
# Build
*.ipa
*.dSYM.zip
@commscheck
commscheck / StringArray+Padding.swift
Last active November 22, 2018 01:03
Pad list of strings
extension Collection where Element == String {
func pad(to commonString: String) -> [String] {
let stringsAndWidths = self.map { string -> (String, Int) in
return (string, string[string.startIndex ..< string.range(of: commonString)!.lowerBound].count)
}
let marginWidth = stringsAndWidths.map { $0.1 }.reduce(0) { result, count -> Int in Swift.max(result, count) }
return stringsAndWidths.map { tuple -> String in
let (string, width) = tuple