Skip to content

Instantly share code, notes, and snippets.

View rxtr007's full-sized avatar
🎯
Focusing

Sachin Ambegave rxtr007

🎯
Focusing
View GitHub Profile
//
// ContentView.swift
// navigation
//
// Created by Thomas Ricouard on 13/10/2019.
// Copyright © 2019 Thomas Ricouard. All rights reserved.
//
import SwiftUI
var hasTopNotch: Bool {
if #available(iOS 11.0, *) {
return UIApplication.shared.delegate?.window??.safeAreaInsets.top ?? 0 > 20
}
return false
}
@rxtr007
rxtr007 / gist:6ab66868213ef8a64e2f86345b701fe8
Created September 25, 2019 12:50 — forked from steipete/ios-xcode-device-support.sh
Using iOS 13/13.1 devices with Xcode 10.3 (instead of Xcode 11)
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
// Xcode 10.3 to Xcode 11 Beta
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
// For iOS 13.1 this trick currently seems to work (as of beta 2):
@rxtr007
rxtr007 / gist:7ba811ff322c49f923d58c7e68b184b9
Created September 25, 2019 12:50 — forked from steipete/ios-xcode-device-support.sh
Using iOS 13/13.1 devices with Xcode 10.3 (instead of Xcode 11)
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
// Xcode 10.3 to Xcode 11 Beta
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
// For iOS 13.1 this trick currently seems to work (as of beta 2):
@rxtr007
rxtr007 / UIView+AnimationContext.swift
Created September 25, 2019 12:50 — forked from CodingMeSwiftly/UIView+AnimationContext.swift
An extension on UIView to retrieve information about the animation context the view is currently in.
import UIKit
extension UIView {
struct AnimationContext {
public let duration: TimeInterval
public let timingParameters: UITimingCurveProvider?
}
}
extension UIView {
@rxtr007
rxtr007 / PSPDFUIKitMainThreadGuard.m
Created August 12, 2019 07:28 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
@rxtr007
rxtr007 / JSON Object Operations
Created March 16, 2019 06:15
Convert Array of object into string and reverse.
let value1 = [
"aboutme" : "",
"active" : 0,
"birthday" : "1992-10-14",
"city_id" : 0,
"email" : "test@test.com",
"fbid" : "",
"firstname" : "test"
] as [String : Any]
extension Array where Element: Comparable {
func insertionSort() -> Array<Element> {
//check for trivial case
guard self.count > 1 else {
return self
}
//mutated copy