Skip to content

Instantly share code, notes, and snippets.

@AdrianBinDC
AdrianBinDC / MapRegionUtility.swift
Last active May 19, 2023 01:13
Generate a MKCoordinateRegions for continents and major oceans
//
// MapRegionUtility.swift
// QuakeData
//
// Created by Adrian Bolinger on 7/9/18.
// Copyright © 2018 Adrian Bolinger.
//
/*
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@shaps80
shaps80 / GeometryObserver.swift
Created July 28, 2023 22:10
Observe Geometry updates on any SwiftUI view
import SwifUI
public struct Geometry: Equatable {
fileprivate var proxy: GeometryProxy?
public var size: CGSize = .init(width: 10, height: 10)
public var safeAreaInsets: EdgeInsets = .init()
public func frame(in coordinateSpace: CoordinateSpaceProtocol) -> CGRect {
proxy?.frame(in: coordinateSpace) ?? .init(origin: .zero, size: size)
}