Skip to content

Instantly share code, notes, and snippets.

View davidseek's full-sized avatar
💭
He/Him

David Seek davidseek

💭
He/Him
View GitHub Profile
func twoSum(_ nums: [Int], _ target: Int) -> [Int] {
// Iterate through every element in numbers
for (i, number1) in numbers.enumerated() {
/**
For every iteration,
iterate through numbers,
where i does not equal j.
*/
for (j, number2) in numbers.enumerated() where i != j {
import UIKit
import MapKit
class ViewController: UIViewController {
// - Outlets
@IBOutlet weak var locationLabel: UILabel!
@IBOutlet weak var mapView: MKMapView!
// MARK: - Get Location
extension LocationManager {
func getLocation(forPlaceCalled name: String,
completion: @escaping(CLLocation?) -> Void) {
let geocoder = CLGeocoder()
geocoder.geocodeAddressString(name) { placemarks, error in
class ViewController: UIViewController {
// - Outlets
@IBOutlet weak var locationLabel: UILabel!
// - Constants
private let locationManager = LocationManager()
class LocationManager: NSObject {
// - Private
private let locationManager = CLLocationManager()
// - API
public var exposedLocation: CLLocation? {
return self.locationManager.location
// MARK: - Get Placemark
extension LocationManager {
func getPlace(for location: CLLocation,
completion: @escaping (CLPlacemark?) -> Void) {
let geocoder = CLGeocoder()
geocoder.reverseGeocodeLocation(location) { placemarks, error in
import Foundation
import CoreLocation
class LocationManager: NSObject {
private let locationManager = CLLocationManager()
override init() {