CptS 479 Homework 1 to 12 solutions

$180.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

CptS 479 Homework 1 HealthApp

1. In Xcode, create a New Project as an iOS App called HealthApp. This project should use
Interface: Storyboard, Life Cycle: UIKit App Delegate, and Language: Swift. Do not check
“Use Core Data”. Checking “Include Tests” is optional.
2. On the Storyboard, make sure “View as: iPhone 11 (wC hR)” is shown at the bottom. In
the view, add a Label at the top of the view with the app’s name “Health App”. Below that
add a Label with “Larry’s Happy Place” with your first name in place of “Larry”. These
labels should be centered horizontally and constrained to be appropriately spaced at the top
of the view.
3. Add an Image View to the view that is centered horizontally and vertically and constrained
to be of size 256×256. Make sure the Content Mode of the Image View is “Aspect Fit”.
4. Centered at the bottom of the view, add a Button called “Next”.
5. Add at least three pleasant (G-rated) images to your project. Be sure to check “Copy items
if needed” next to “Destination” if you drag-and-drop the image files into your project.
6. The basic functionality of the app is to show the images one-by-one, cycling through the
images by tapping the “Next” button. When you reach the last image, tapping “Next” will
restart the cycle at the first image. Be sure that the view is initialized with the first image
when the app starts up. You will need to create an IBOutlet to the Image View and an
IBAction for the “Next” button. See the FirstApp example in the Introduction lecture notes
for some hints on how to do this.
7. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
8. Be sure that auto layout constraints are set so that the view elements are appropriately
displayed with no overlap or trimming regardless of device orientation.
2
Storyboard:
Simulator:

CptS 479 Homework 2 HealthApp that displays happy quotations

For this homework you will implement a different version of the HealthApp that displays happy
quotations and also allows you to enter new quotations. See screen shots below. Specifically,
1. You can create a new project or modify your HW1 project.
2. Create a new swift file named “Quotation.swift” which should contain the definition of the
Quotation class. This class should have two properties: a string to hold the quote and an
optional string to hold the author. The init method should require a string for the quote, but
the author string is optional and should be set to nil if not provided.
3. In the main view of the Storyboard, add a Label at the top of the view with the app’s name
“Health App”. Below that add a Label with “Larry’s Happy Quotes” with your first name
in place of “Larry”. These labels should be centered horizontally and constrained to be
appropriately spaced at the top of the view.
4. Below the labels should be two text fields. The first text field should have the label
“Quote:” to the left and fill the rest of the view horizontally. The second text field should
have the label “Author:” to the left and fill the rest of the view horizontally. Set both text
field’s delegate to the ViewController and define the textFieldShouldReturn delegate
method so that the keyboard disappears when you tap Return on the keyboard.
5. Centered below the text fields should be a button titled “Add”. When you tap the Add
button, if the Quote text field is non-empty, then you should create a new instance of the
Quotation class with that quote, which should be added to the end of your current list of
quotations. If the author is provided, then that should be added to the Quotation instance.
If the Quote text field is empty, then the Add button should have no effect. If a Quotation
is added, then the two text fields should be cleared automatically. Anytime the Add button
is tapped, if the keyboard is present, it should be removed. This can be done by executing
“self.view.endEditing(true)”. Quotations added while the app is running do not need to
persist when the app is terminated.
2
6. This app will not display any images. Instead, a Quotation Label should be centered
vertically in the view and fill the whole view horizontally. Set the “Lines” attribute of the
label to 4, and set the “Alignment” attribute to Center.
7. As in HW1, centered at the bottom of the view, should be a Button called “Next”. Tapping
the Next button cycles through all the quotations, including your initial three and any added
quotations. Tapping Next on the last quotation should cycle back to the first.
8. Initialize your app with at least three quotations. Quotations should be displayed in the
Quotation label surrounded by double quotes. If the author is provided, then it should be
displayed after the quote. If no author is provided, then “Anonymous” (without the quotes)
should be displayed after the quote.
9. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
10. Be sure that auto layout constraints are set so that the view elements are appropriately
displayed with no overlap or trimming regardless of device orientation.
3
Storyboard:
Simulator:

CptS 479 Homework 3 Next button functionality

This homework builds on HW2 by replacing the Next button functionality with an automatic
advance to the next quotation after some delay that is controlled by a slider. See screen shots below.
Specifically,
1. First, ensure that your HW3 app has all the required functionality of HW2, except for the
Next button, which should be removed. Part of HW3’s grade will be based on HW2
successful functionality.
2. At the bottom of the view, add a “Delay: 00s” label on the left side and a slider to the right
of the label. Layout the slider first to be 20 points from the right safe area and 0 points from
the bottom safe area. Layout the label to be vertically centered to the slider and 0 points
from the left safe area. The label should use a  width constraint just wide enough to display
the widest label, and the slider should use all remaining horizontal space. See the “UI
Design” lecture video for an example of how to do this.
3. The slider should have an initial value of 5, minimum of 1, and maximum of 10. This value
represents the number of seconds delay before advancing to the next quotation. As the
slider value is changed, the delay label should also change to display the current value of
the delay.
4. When the app starts, the auto-advance feature should begin immediately. Use a Timer to
implement this feature. You do not need to use the MyTimer class from the lecture. Any
changes to the delay via the slider should immediately reset the delay time accordingly.
5. As in the HW2 app, initialize the app with at least three quotations. New quotations should
be added to the end of the list of quotations and displayed at the end of the current cycle
through the quotations.
6. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
7. Be sure that auto layout constraints are set so that the view elements are appropriately
displayed with no overlap or trimming regardless of device orientation.
2
Storyboard:
Simulator:

CptS 479 Homework 4 add quotation functionality to a second view

This homework builds on HW2 by moving the add quotation functionality to a second view and using a navigation controller to move between views and manage titles. See screen shots below. Specifically, 1. First, ensure that your HW4 app has all the required functionality of HW2, except as changed below. Part of HW4’s grade will be based on proper HW2 functionality. 2. From the main view remove the “Health App” label, “’s Happy Quotes” label, “Quote:” label and text field, “Author:” label and text field. 3. Embed the main view in a navigation controller. Set the main view’s navigation item prompt to “Health App” and title to “’s Happy Quotes” 4. Add a Bar Button Item to the right side of the main navigation bar and set it’s System Item attribute to “Add” (should appear as a “+” sign). 5. Add a new View Controller to the Storyboard. Create a new view controller class for this view called “AddQuotationViewController” in a new file with the same name. 6. Create a “Show” segue from the “Add” bar button on the main view to the AddQuotation view. This should create a navigation bar on the AddQuotation view. Set this navigation bar’s prompt to “Health App” and title to “Add Quotation”. Set the segue’s identifier. 7. Below the navigation bar in the AddQuotation view, add a label that displays “Quotation #”, where is the number of the next quotation to add, i.e., the number of current quotations plus one. This information should be passed from the main view to the AddQuotation view using the prepare for segue on the “Add” button segue. 8. Add the “Quote:” label and text field, and the “Author:” label and text field below the quotation number label. Be sure to constrain these elements appropriately so that the labels stay in place even if you type a long quote or author. 9. For all the text field handling that was in the main view controller in HW2, move this functionality to the AddQuotation view. 10. In the AddQuotation navigation bar, add a Bar Button Item to the left side (overwriting the Back button) and set its System Item to “Cancel”. Add a Bar Button Item to the right side 2 and set its System Item to “Save”. If the Cancel button is tapped, then the app should use an unwind segue to return to the main view and no quotation should be added, regardless of what text was entered in the text fields. If the Save button is tapped, then the app should use an unwind segue to return to the main view. If there was some text in the Quote text field, then a new quotation with the appropriate quote and author should be added to the end of the quotations cycled through with the Next button on the main view. If the Quote text field was empty, then no quotation should be added, but the app should still return to the main view. 11. As in the HW2 app, initialize the app with at least three quotations. 12. Test your app using the iPhone 11 simulator, which is the same simulator we will use to grade your app. 13. Be sure that auto layout constraints are set so that the view elements are appropriately displayed with no overlap or trimming regardless of device orientation. Storyboard: 3 Simulator:

CptS 479 Homework 5 displaying all the quotations in a table

This homework builds on HW4 by displaying all the quotations in a table and displaying the quotation when the table row is tapped. See screen shots below. Specifically, 1. Replace the Main view controller with a table view controller. The table view should be dynamic and use the Subtitle style for its one prototype cell. Be sure to give the table view prototype cell an Identifier, e.g., “subtitleCell”. The new Main table view controller should be embedded in a navigation controller with title “’s Happy Quotes” and prompt “Health App”, where should be your first name. 2. Create a new UITableViewController class and associate it with the Main table view controller. The table should be initialized with at least three quotes, where the Title text should be the quote, and the Detail text should be the author (or “Anonymous” if there is no author). It’s okay if the quote is truncated with an ellipsis. 3. Implement swipe-left-to-delete in the Main table view controller. 4. Add a bar button item to the right side of the navigation bar and set its System Item to Add (“+”). Tapping this button should segue to the Add Quotation view, which should behave just as in HW4. When you unwind back to the Main view, the new quotation (if valid) should be added to the table. 5. Tapping a row in the Main table should segue to a Detail view that shows the full quote in a Text View and the author’s name (or “Anonymous” if no author). 6. Test your app using the iPhone 11 simulator, which is the same simulator we will use to grade your app. 7. Be sure that auto layout constraints are set so that the view elements are appropriately displayed with no overlap or trimming regardless of device orientation. 2 Storyboard: 3 Simulator: 4

CptS 479 Homework 6 adding three settings: a local setting…

This homework builds on HW5 by adding three settings: a local setting to sort the quotations, a
local setting to show/hide authors, and a global setting to filter anonymous quotations. See screen
shots below. Specifically,
1. Ensure your app has all HW5 capabilities, including a table view to list and delete the
quotations, an add quotation view to add quotations, and a detail view to view the quotation
details. Note that the table deletion will need some modification so that the correct
quotation is deleted regardless of the settings.
2. On the Quotations table view, add a bar button item in the shape of a gear to the left in the
navigation bar that segues to the Settings view.
3. Add a Settings table view controller that uses a static table with two sections: “Local
Settings” and “Device Settings”. Under Local Settings include two switches with labels
“Sort Quotations” and “Show Authors”. Under Device Settings a label “Filter
Anonymous:” followed by the setting: “On” or “Off”. The app should use the UserDefaults
singleton class to store these settings.
4. The “Sort Quotations” setting should be initialized to false (off) by default. When off, the
quotations should be listed in the order added. When on, the quotations should be listed in
alphabetical order by the quotation.
5. The “Show Authors” setting should be initialized to true (on) by default. When on, the
authors should be included in the quotations list, including “Anonymous”. When off, only
the quotes (no authors) should be shown in the quotations list.
6. Add a Settings Bundle to your app, and setup just one device setting “Filter Anonymous”,
which should be a toggle switch. This setting should be initialized to false (off) by default.
When off, all quotations (whether they have an author or not) should be displayed. When
on, quotations with “Anonymous” authors should not be displayed.
7. Add the ability for the app to transition directly to the Device Settings page for the app
when the “Filter Anonymous” row is tapped in the Settings table view.
2
8. All three settings should have an immediate effect the next time the Settings table view or
the Quotations table view are displayed, even if you leave the app and return to the view.
All three settings should persist, even after terminating and restarting the app.
9. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
10. Be sure that auto layout constraints are set so that all view elements are appropriately
displayed with no overlap or trimming regardless of device orientation.
Storyboard:
Root.plist
3
Simulator (just showing new HW6 capabilities):

CptS 479 Homework 7 adding an alert to confirm deletion…

This homework builds on HW5
1 or HW6 (your choice) by adding an alert to confirm deletion and
adding the ability to choose a quotation for a “Quote of the Day” notification. See screen shots
below. Specifically,
1. Ensure your app has all HW5 capabilities, including a table view to list and delete the
quotations, an add quotation view to add quotations, and a detail view to view the quotation
details. You can still use HW6 if you want, but we will not be accessing the settings view
or changing any of the device settings.
2. Implement an alert that is triggered when you attempt to delete a table entry. After tapping
Delete in the row, an alert should appear with title “Delete Quotation?” and the message
set to the quote to be deleted. The two actions should be “Delete” with .destructive style,
and “Cancel” with .cancel style. Tapping Cancel should do nothing, and tapping Delete
should proceed to delete the table row.
3. For the notification, we will need to uniquely identify each quotation with a string ID that
is passed in the userInfo dictionary of the notification and then back to the app when the
user taps the notification. So, add the new property “id” to the Quotation class of type
String. In the init method, set this “id” to “UUID().uuidString”. This is guaranteed to
generate a unique identifier each time.
4. In the AppDelegate (or the SceneDelegate) request authorization to schedule notifications.
When the app starts up, we will always choose “Allow”, but we will late disable
notifications inside the device settings to check that you handle this case.
5. On the quotation detail view controller, center a button titled “Schedule Notification”
underneath the author label. When tapped, the app should first check that notifications are
still allowed, and if so, schedule a notification with title “Quote of the Day” and the body
set to the quote. You should also set the userInfo[“id”] dictionary entry to the quotation’s
1 My solution to HW5 is available on Blackboard Learn. You may use it as a starting point for this
homework.
2
“id”. Set the notification to trigger five seconds after adding it, and then add it to the
UserNotificationCenter.
6. Add a handleNotification method to the main quotation table view controller. This method
should extract the quotation id from the userInfo dictionary, set a class variable (e.g.,
quoteOfTheDayID) to this id, and reload the table. If this quotation is still in the table, its
quote should be displayed in red. All other quotes, even ones previously colored red, should
be reset back to the default color.
7. Next, you need to call this handleNotification method when the app returns to the
foreground (after the user taps the notification) by implementing the didReceive method of
the UNUserNotificationCenterDelegate. Since we don’t know which view is currently the
top view controller on the navigation stack, we will search through them all to find the
main quotation table view controller and then call its handleNotification method. Below is
a code snippet for doing this inside didReceive in the AppDelegate, assuming the main
quotation table view controller is of type QuotationTableViewController.
8. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
9. Be sure that auto layout constraints are set so that all view elements are appropriately
displayed with no overlap or trimming regardless of device orientation.
let navVC = UIApplication.shared.windows.first!.rootViewController
as! UINavigationController
let vcs = navVC.viewControllers
for vc in vcs {
if let mainVC = vc as? QuotationTableViewController {
mainVC.handleNotification(response)
}
}
3
Storyboard (based on HW5):
4
Simulator (just showing new HW7 capabilities):

CptS 479 Homework 8 trace a circle using a custom gesture…

This homework will be a standalone version of our HealthApp that tests the user’s ability to trace
a circle using a custom gesture. See screenshots below. Specifically,
1. Create a new Xcode project called HealthApp that has a single view embedded in a
navigation controller with title “Circle Test” and prompt “Health App”. Centered at the top
of the view is a two-line label containing “Trace a circle in between the two circles below.”
2. In the center of the view draw two concentric blue circles, one with radius 50 and one with
radius 150. You can use the code snippet below to draw a circle. You can access the center
point of the view using “self.view.center”.
3. Centered at the bottom of the view, add a “Clear” button, which will be used to clear the
red boxes that trace your gesture (see #6 below). Just above the button, center a label that
will display “Success!” in green or “Fail!” in red after each attempt to trace the circle. This
label should be hidden initially, hidden as soon as you begin a trace, and hidden if the Clear
button is tapped.
1 The university has asked us to not have assignments due on March 17-18, because March 17 is a
school holiday. So, HW8 is due on March 19. But note that HW9 will still be due on March 24.
func drawCircle(center: CGPoint, radius: Float) {
let shapeLayer = CAShapeLayer()
let circlePath = UIBezierPath(arcCenter: center,
radius: CGFloat(radius),
startAngle: 0, endAngle: (2 * CGFloat.pi), clockwise: true)
shapeLayer.path = circlePath.cgPath
shapeLayer.fillColor = UIColor.clear.cgColor
shapeLayer.strokeColor = UIColor.blue.cgColor
self.view.layer.addSublayer(shapeLayer)
}
2
4. Implement a custom gesture class called CircleGestureRecognizer. This gesture should
have three properties: minRadius, maxRadius, and center. The general behavior of the
gesture is to recognize a complete circle in which the distance D of each point from the
center satisfies (minRadius  D  maxRadius). As soon as this distance constraint is
violated, the gesture should fail. If after the user completes the trace, the circle is not
complete, then the gesture should fail. The five methods of your CircleGestureRecognizer
class should function as follows:
a. touchesBegan: Check that the first point in touches satisfies the distance
requirement. If not, set the state to .failed, else retain the point and set the state to
.began.
b. touchesMoved: Check that the first point in touches satisfies the distance
requirement. If not, set the state to .failed, else retain the point and set the state to
.changed.
c. touchesEnded: Check that the first point in touches satisfies the distance
requirement. If not, set the state to .failed, else check that the circle is complete by
checking that there is at least one point in each of the four quadrants of the circle.
If not, then set the state to .failed, else set the state to .ended. For example, a point
is in the first quadrant if (point.x > center.x) and (point.y < center.y).
d. touchesCancelled: Set the state to .cancelled.
e. reset: Clear your array of retained points.
5. In the view controller, create an instance of the CircleGestureRecognizer, set the center to
the view’s center, set minRadius to 50, and set maxRadius to 150. Add the gesture to the
view.
6. In the action that is called by the circle gesture, first extract the point and the state of the
sender. If the state is .began, then draw a small red box2
at the point and ensure the label is
hidden. If the state is .changed, then draw a small red box at the point. If the state is .ended,
then draw a small red box at the point and display “Success!” in the label. If the state is
.cancelled, then display “Fail!” in the label.
7. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
8. You may assume the device will always be in portrait mode for this app.
2 See the lecture notes for code to draw and clear small red boxes in the view.
3
Simulator:

CptS 479 Homework 9 HealthApp that maintains the user’s total distance traveled…

This homework will be a standalone version of our HealthApp that maintains the user’s total
distance traveled, tracks the user on a map, and continually updates information about the nearest
hospital. See screenshots below. Specifically,
1. Create a new Xcode project called HealthApp that has a single view embedded in a
navigation controller with title “Distance Traveled” and prompt “Health App”. The main
view should have a “Start” button in the upper left and a “Stop” button in the upper right.
Below that should be three labels: “Distance Traveled”, “Nearest Hospital”, and
“Distance”. And the remaining part of the view below the labels should be occupied by a
Map Kit View.
2. When first run, the app should request location when-in-use authorization for which you
may assume “Allow While Using App” will be selected.
3. Tapping the Start button (assuming location services are enabled) should start location
updates with the map tracking the current location. Each time didUpdateLocation is called,
the app should compute the distance from the current location to the last updated location
and add that distance to the “Distance Traveled” value. Also, each time didUpdateLocation
is called, the app should use a MKLocalSearch request on query “hospital” to find the
nearest hospital, display its name in the “Nearest Hospital” label and its distance in meters
in the “Distance” label, and add it to the map as an annotation (after removing any existing
annotation). If this information is unavailable (e.g., the request results in an error or no map
items), then a question mark “?” should be display for the nearest hospital name and
distance value.
4. Tapping the Stop button should stop updating the location and remove the tracking “dot”
from the map. The nearest hospital information can remain.
5. The app should be responsive to changes in the device settings that disable location
services. In particular, if the Start button is tapped, but location services are disabled, a
“Location Services Disabled” alert (see screenshot) should appear. If the location was
2
updating before you disabled location services, location updates should be turned off when
you re-enter the app.
6. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
7. Be sure that auto layout constraints are set so that all view elements are appropriately
displayed with no overlap or trimming regardless of device orientation.
Simulator:
3

CptS 479 Homework 10 Xcode project called HealthApp

This homework will be a standalone version of HealthApp that allows us to download the latest
headline health news from newsapi.org and view the articles in Safari. See screenshots below.
Specifically,
1. Create a new Xcode project called HealthApp that has a table view controller embedded in
a navigation controller with title “Health News” and prompt “Health App”. Add a bar
button called “Update” in the upper right.
2. Create a NewsItem class with string properties for the news story’s source, title and URL,
and an image property to hold an image pertaining to the story. All four properties should
be optionals and the table should display a default string or image if the story does not
provide this information. For example, the last row in the screenshots below is a news story
that provided no URL to an image, so that row shows a default image.
3. When the app starts, and whenever the Update button is tapped, the app should make a
URLSession datatask request to the following newsapi URL (where the ??? should be
replaced by your personal API key from https://newsapi.org). You can use a different
“country” parameter, or omit it altogether, if you want.
https://newsapi.org/v2/top-headlines?country=us&category=health&apiKey=???
4. The response from the request will be a JSON object from which the app will need to
extract each story’s title, source, image URL, and main URL. You can see an example of
this JSON object at https://newsapi.org/s/us-health-news-api. If a story’s main URL is not
available, then that story should be discarded and not appear in the table.
5. The general approach to updating the table is to create new NewsItem class instances for
each story based on the initial response, but with the image property set to the default
image, and then reload the table data source. Next, the app should attempt to load the
images by following the urlToImage URLs. As each one returns, the app should create an
image from it, load it into the corresponding NewsItem instance, and then reload the table
data source. This way, the news story titles and sources will refresh quickly, and the images
will refresh as they become available.
2
6. The table view cells should use the “Subtitle” style. The cell should set the imageView to
the image from the story’s urlToImage (or default image, if not available), the textLabel to
the story’s title, and the detailTextLabel to the story’s source name. Again, each of these
should have some default value if the information is not provided in the response.
7. If the user selects a row in the table, then the app should present a SFSafariViewController
to display the main URL for the story.
8. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
9. Be sure that auto layout constraints are set so that all view elements are appropriately
displayed with no overlap or trimming regardless of device orientation. Long titles or
sources can be abbreviated with an ellipsis, and images may vary in their width (as seen in
the screenshots below). You are welcome to use a custom table view cell that better controls
the size and margins of images, but this is optional.
Simulator:

CptS 479 Homework 11 table view to list and delete the quotations…

This homework builds on the HW5
2
capabilities by adding Core Data to persistently store the
quotation information. Specifically,
1. Ensure your app has all HW5 capabilities, including a table view to list and delete the
quotations, an add quotation view to add quotations, and a detail view to view the quotation
details.
2. If you start with a New Project, then be sure to check the “Use Core Data” option. If you
work from an existing project, you can still create a new project using Core Data and copy
over the Core Data Stack code from AppDelegate.swift. You will also need to add a Core
Data Model to the project.
3. In the Core Data Model, add an Entity called Quotation with the attributes “quote” and
“author” both of type String.
4. Implement Core Data functionality for inserting, deleting and fetching quotations from the
database. Additions and deletions to the table should be made to the Core Data store as
well as reflected in the table. Whatever state the table is in when the app is terminated, the
app should return to that state when rerun by fetching the quotations stored in Core Data.
5. Do not preload any quotations. The table should be initially empty.
6. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
7. Be sure that auto layout constraints are set so that all view elements are appropriately
displayed with no overlap or trimming regardless of device orientation.
1 Note this homework is due a week later, because your project proposals are due April 7.
2 My solution to HW5 is available on Blackboard Learn. You may use it, or your own, as a starting
point for this homework.

CptS 479 Homework 12 HealthApp that is a Game application

What Health App would be complete without a relaxing game of hunt the coronavirus. For this
homework you will implement a SpriteKit game that shoots rockets at the coronavirus. See
screenshots below. Specifically,
1. Create a new project called HealthApp that is a Game application and uses the SpriteKit
game technology.
2. In the GameViewController, set scene.scaleMode = .aspectFit and disable the displaying
of FPS and NodeCount.
3. In the GameScene, you can remove all the code, leaving only an empty didMove method
and touchesEnded method.
4. In the Game Scene editor, remove the “Hello, World!” label. Add a “Health App” label
centered at the top and a “Score: 0” label centered at the bottom.
5. The app will need two images: an image of the target (i.e., coronavirus) and an image of
the projectile (i.e., rocket). The width and height of these images should be 128 pixels or
less. You may use different images for the target and projectile, as long as they comply
with the width and height requirement.
6. When the app starts, a target should spawn every 3 seconds. The target should spawn in a
random location with a random impulse (-200 ≤ dx ≤ 200 and -200 ≤ dy ≤ 200). The
target node should have affectedByGravity=false, linearDamping=0, and restitution=1.
The target should collide with other targets and with the side of the screen. When a target
comes into contact with a projectile, both objects should be removed from the scene, and
the score should increase by 1.
7. Anytime the user taps on the screen at position (x,y), a projectile should be spawned at the
same x position, but at the bottom of the screen. The projectile node should have
affectedByGravity=false, linearDamping=0, and velocity=(0,200), i.e., straight up. The
projectile should not collide with anything. When a projectile comes into contact with a
target, both objects should be removed from the scene, and the score should increase by 1.
2
8. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
9. You may assume your app will be tested in portrait mode only.
Scene Editor:
3
Simulator: