Skip to content

Instantly share code, notes, and snippets.

@herbgarlow
herbgarlow / UIImage+PixelColor.swift
Created October 28, 2015 22:52 — forked from marchinram/UIImage+PixelColor.swift
iOS Swift UIImage subscript extension to get pixel color
import UIKit
extension UIImage {
subscript (x: Int, y: Int) -> UIColor? {
if x < 0 || x > Int(size.width) || y < 0 || y > Int(size.height) {
return nil
}