Skip to content

Instantly share code, notes, and snippets.

View ahmetws's full-sized avatar

Ahmet Yalcinkaya ahmetws

View GitHub Profile
struct LazyView<Content: View>: View {
let build: () -> Content
init(_ build: @autoclosure @escaping () -> Content) {
self.build = build
}
var body: Content {
build()
}
}
@schickling
schickling / UIImageFixedOrientationExtension.swift
Last active September 9, 2024 13:54
Extension to fix orientation of an UIImage (Sets orientation to portrait)
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == UIImageOrientation.Up {
return self
}
var transform: CGAffineTransform = CGAffineTransformIdentity
@corbett
corbett / QuickAndAccurateiOSLocation.m
Created March 17, 2012 15:55
Objective-C to obtain quick and accurate location in iOS
// setup
- (void)viewDidLoad
{
...
self.locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
locationManager.distanceFilter = 250;
self.desiredLocationFreshness = 15.0; // desired freshness in s
self.desiredLocationAccuracy = 100.0; // desired location accuracy in m