This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
var body: some View { | |
VStack { | |
Text("SwiftUI") | |
Indicator() | |
}.frame(width: 150, height: 100, alignment: .center) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
truct ContentView: View { | |
var body: some View { | |
HStack { | |
Text("SwiftUI") | |
.padding(.trailing) | |
Text("Basics") | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
var body: some View { | |
HStack { | |
Text("SwiftUI") | |
.padding(100) | |
Text("Basics") | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HStack (spacing: 100) { | |
VStack { | |
Text("WAMF") | |
Text("Tutorial") | |
} | |
VStack(alignment: .trailing) { | |
Text("SwiftUI") | |
Text("Basics") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HStack { | |
VStack { | |
Text("WAMF") | |
Text("Tutorial") | |
} | |
VStack { | |
Text("SwiftUI") | |
Text("Basics") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView : View { | |
var body: some View { | |
Text("Hello World") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() |
NewerOlder