Skip to content

Instantly share code, notes, and snippets.

View camdeardorff's full-sized avatar
👋

Cameron Deardorff camdeardorff

👋
  • iOS @ ForeFlight
  • Colorado Springs, Colorado
View GitHub Profile
@camdeardorff
camdeardorff / GifBuilder.swift
Created July 2, 2020 20:58
Make a GIF from a list of UIImages
//
// GifBuilder.swift
// Landscape
//
// Created by Cameron Deardorff on 6/10/20.
// Copyright © 2020 Cameron Deardorff. All rights reserved.
//
import UIKit
import ImageIO
//
// UIImagable.swift
// Landscape
//
// Created by Cameron Deardorff on 1/31/20.
// Copyright © 2020 Cameron Deardorff. All rights reserved.
//
import UIKit
import Photos
@camdeardorff
camdeardorff / ValidRegionMapViewExtension.swift
Last active May 19, 2018 16:04
An extension to the MKMapView class with an function to determine whether a region is valid and won't cause a crash if placed on a map.
// to solve the invalid region <center:##.###, ##.### span:##.###, ##.###> issue
extension MKMapView {
// determines if the region provided is in fact a valid region that can be shown on the map
// notes: latitude -> [-90, 90], !nan, !inf
// longitude -> [-180, 180], !nan, !inf
// latitudeDelta -> [0, 180], !nan, !inf
// longitudeDelta -> [0, 360], !nan, !inf
func canShow(region: MKCoordinateRegion) -> Bool {
//.....center latitude
return region.center.latitude != Double.infinity && region.center.latitude != Double.nan