Skip to content

Instantly share code, notes, and snippets.

View WildStudio's full-sized avatar
Get shit done!

Christian Aranda WildStudio

Get shit done!
  • WildStudio
  • Barcelona
View GitHub Profile
@WildStudio
WildStudio / UIViewPropertyAnimator
Created May 30, 2019 10:13
Adding spring animation with UIViewPropertyAnimator
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let toViewController = transitionContext
.viewController(forKey: .to) as? DetailViewController else { return }
let animator = UIViewPropertyAnimator(duration: Constant.duration, dampingRatio: 0.82)
let container = transitionContext.containerView
container.addSubview(toViewController.view)
let offscreenY = toViewController.view.bounds.height - toViewController.view.frame.minY + 20
toViewController.positionContainer(left: 20.0,
right: 20.0,
@WildStudio
WildStudio / firebase-iOS-breakdown.swift
Created June 14, 2021 11:02 — forked from zntfdr/firebase-iOS-breakdown.swift
Firebase iOS Version breakdown
// How to:
// 1. Go in the Firebase Analytics Dashboard
// 2. Filter iOS Platform only
// 3. Scroll down, select `Device` under the "What is your audience like?" widget
// 4. Export the CSV data (top right corner, there's a download button with Download CSV option)
// 5. Open the file and select the iOS breakdown raw data
// 6. Replace your data with the sample data in this script
// 7. Run the script in a Xcode Playground
// 8. See the terminal output
@WildStudio
WildStudio / Two Text taking equal width
Last active September 6, 2019 08:55
GeometryReader
struct ContentView: View {
var body: some View {
GeometryReader { geometry in
HStack {
Text("SwiftUI")
.frame(width: geometry.size.width / 2, height: 100)
Text("Basics")
.frame(width: geometry.size.width / 2, height: 100)
}
}
@WildStudio
WildStudio / Custom frame
Last active September 4, 2019 14:25
SwiftUI - Customising the frame in our indicator
struct ContentView: View {
var body: some View {
VStack {
Text("SwiftUI")
Indicator()
}.frame(width: 150, height: 100, alignment: .center)
}
}
@WildStudio
WildStudio / Adds padding to trailing
Created September 4, 2019 14:01
SwiftUI adding padding to trailing
truct ContentView: View {
var body: some View {
HStack {
Text("SwiftUI")
.padding(.trailing)
Text("Basics")
}
}
}
struct ContentView: View {
var body: some View {
HStack {
Text("SwiftUI")
.padding(100)
Text("Basics")
}
}
}
@WildStudio
WildStudio / Provide spacing HStack init
Last active September 4, 2019 10:17
Adding Spacing and alignment inside your SwiftUI stacks
HStack (spacing: 100) {
VStack {
Text("WAMF")
Text("Tutorial")
}
VStack(alignment: .trailing) {
Text("SwiftUI")
Text("Basics")
}
}
@WildStudio
WildStudio / VStack - HStack
Created September 4, 2019 10:09
SwiftUI Layout Basics
HStack {
VStack {
Text("WAMF")
Text("Tutorial")
}
VStack {
Text("SwiftUI")
Text("Basics")
}
}
import SwiftUI
struct ContentView : View {
var body: some View {
Text("Hello World")
}
}
@WildStudio
WildStudio / gist:547bffa9562b1e97eb93580a3b2bd3bb
Last active August 15, 2019 16:43
SceneDelegate.swift snippet
// Instantiate a new UIWindow with the size of our phone screen and assign it to the window property
let window = UIWindow(frame: UIScreen.main.bounds)
// Instantiate a UIHostingController which is a ViewController but it is capable of holding the new SwiftUI View.
window.rootViewController = UIHostingController(rootView: ContentView())
self.window = window
// Make the window key and visible. This is telling it is the active window.
window.makeKeyAndVisible()