Fully updated for Xcode 11.2
SwiftUI’s scaleEffect()
modifier lets us increase or decrease the size of a view freely.
For example, we could make a text view five times its regular size like this:
Text("Up we go")
.scaleEffect(5)
You can scale the X and Y dimensions independently if you want, allowing you to squash views like this:
Text("Up we go")
.scaleEffect(x: 1, y: 5)
If you want more control, you can specify an anchor for your scaling like this:
Text("Up we go")
.scaleEffect(2, anchor: .bottomTrailing)
That makes the text view twice its regular size, scaled from the bottom-right corner.
SPONSORED Instabug helps you identify and resolve severe crashes quickly. You can retrace in-app events and know exactly which line of code caused the crash along with environment details, network logs, repro steps, and the session profiler. Ask more questions or keep users up-to-date with in-app replies straight from your dashboard. Instabug takes data privacy seriously, so no one sees your data but you! See more detailed features comparison and try Instabug's crash reporting SDK for free.
The biggest ever Hacking with Swift sale is now on, letting you save 50% on all books and bundles. Learn something new with Swift and enjoy great savings while the sale lasts!
Click here to save 50% in our Black Friday sale!