Skip to content

Instantly share code, notes, and snippets.

View KyleGoslan's full-sized avatar

Kyle Goslan KyleGoslan

View GitHub Profile
@KyleGoslan
KyleGoslan / Array+Extension.swift
Created February 2, 2018 13:48
Swift Array Extension to merge unique values into an existing array. Elements must be conform to the Equatable protocol
//The array passed to the function is the array of object that will be omitted from the final array. Important if your merging an array of objects where the Equatable property may be the same but others may differ.
extension Array where Element: Equatable {
public mutating func mergeElements<C : Collection>(newElements: C) where C.Iterator.Element == Element{
let filteredList = newElements.filter({!self.contains($0)})
self.append(contentsOf: filteredList)
}
}
@KyleGoslan
KyleGoslan / Demo.swift
Created November 9, 2020 18:42
SnapKit Scroll View Example
//
// SampleSaleArticleViewController.swift
// aSample
//
// Created by Matthew hammond on 09/11/2020.
//
import UIKit
import Buy
import SnapKit