Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SWIFT (ios) CODE PLEASE. Your fitness tracking app shows users a list of possible challenges, grouped by activity type (i.e. walking challenges, running challenges, calisthenics

SWIFT (ios) CODE PLEASE.

Your fitness tracking app shows users a list of possible challenges, grouped by activity type (i.e. walking challenges, running challenges, calisthenics challenges, weightlifting challenges, etc.) A challenge could be as simple as "Walk 3 miles a day" or as intense as "Run 5 times a week."

Using arrays of type String, create at least two lists, one for walking challenges, and one for running challenges. Each should have at least two challenges and should be initialized using an array literal. Feel free to create more lists for different activities.

In your app you want to show all of these lists on the same screen grouped into sections. Create a challenges array that holds each of the lists you have created (it will be an array of arrays). Using challenges, print the first element in the second challenge list.

All of the challenges will reset at the end of the month. Use the removeAll to remove everything from challenges. Print challenges.

Create a new array of type String that will represent challenges a user has committed to instead of available challenges. It can be an empty array or have a few items in it.

Write an if statement that will use isEmpty to check if there is anything in the array. If there is not, print a statement asking the user to commit to a challenge. Add an else-if statement that will print "The challenge you have chosen is " if the array count is exactly 1. Then add an else statement that will print "You have chosen multiple challenges."

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions