The Startup
Published in

The Startup

Creating an Expandable Button in Swift

We’re going to build a custom expandable button in Swift, like the one below:

First off, it’s important to understand the view structure that is necessary to implement a component like this one.

We will create a subclass of UIView that will be composed of 5 subviews like so:

  1. A containerStackView that will hold the menuButton and the expandedStackView
  2. A menuButton that, when tapped, will handle the expanding animation
  3. An expandedStackView that will be shown or…




Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +756K followers.

Recommended from Medium

The Common Reuse Principle on iOS

My visible eye bags are a hex placed upon you

Bring your old iOS Library back to Life in just few easy Steps

WenX iOS App Officially Listed on Apple App Store!

Unit testing private properties in Swift

iOS Provisional Notifications

How to Present Customizable Bottom Sheets in iOS 15

Setting Up Self-Hosted Runner for Github Actions for Appium Testing React Native App running on an…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ale Patrón

Ale Patrón

More from Medium

Every iOS developer should know these Xcode tricks


Setting up Jazzy for your Swift app project on Apple Silicon (M1)

Swift Collections