DEV Community

keepoSteepo
keepoSteepo

Posted on

1

Blog Vent 2 (Actions & Outlets)

This time around, I learned how to connect my code to the views and controls created in the storyboard so that they respond to user actions. There are two kinds of connections between storyboards and code; actions and outlets. Outlets connect variables in your code to objects in your storyboard in order to access those objects within your code and get information or make changes when the app is running. Actions connect controls like switches and buttons to methods in your code. I put this in to practice by building the color mix app. This app has a display screen at the upmost part of the screen. Below, three buttons and three sliders, each one assigned a color between red, blue and green. The display screen and sliders are outlets and the buttons are actions. As the button is pressed, the display screen will show the color associated with that button, the slider is the intensity of the color from min to max. The sliders can be in a number of positions and the buttons can be combined by only having blue and green on or red and blue, etc. After, I polished the interface and gave it a clean look. The background is silver, the buttons are black except when pressed, then they change accordingly to their color and the sliders color changes according to how much of the min/max is showing.

I almost forgot; I also added a reset button that does exactly that. The buttons are enabled when the switch is on, otherwise they are nonfunctional.

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs