代写 swift compiler ACAD 277 App 3 Extra Credit Flashcards 2.0

ACAD 277 App 3 Extra Credit Flashcards 2.0
Goal
• You will update your Flashcards iPhone app.
• It will have a tab bar for two views – one to display a flashcard and one for the
table of flashcards.
• The tab bar item that displays a table of flashcards will allow the user to add and
delete cards.
• Add data persistence to the model by saving a plist file to your app’s Documents
folder. DO NOT use User Defaults.
• We strongly recommend you check your project on each device (via the
simulator) against each instruction before submission. You’d be surprised at how many things you can fix!
Assignment
• Duplicate your high-level App2 (LastFirstApp2) folder. Rename it to LastFirstApp3 where Last is replaced with your last/family name and First is replaced with your first name. If you have a preferred first name, then use it for First. Don’t use spaces in the project name.
• Make sure the app display name is “Flashcards”.
• Create a View Controller Scene in Storyboard to add a flashcard:
– Add a navigation bar on top and add bar button items for Cancel and Save. Alternatively, you can create a button for save (“Add Flashcard”) below the Text View and Text Field, and then use a “Show (e.g. Push)” segue which will create a navigation bar with a Back button.
– Add a label to tell the user what to enter.
– Add a Text View to input a question.
– Add a Text Field to input an answer.
– Keyboard should dismiss when the return key is pressed on the keyboard
associated with the text field.
• Create the Swift class (Cocoa Touch subclass of UIViewController) for the
AddViewController.
– Make it conform to the UITextViewDelegate and UITextFieldDelegate
protocols.
– Implement the UITextViewDelegate and UITextFieldDelegate
methods to enable/disable the Save button. It should be enabled when there is
text in the text view and the text field.
– Create a property for the model and use its singleton method.
– Create the appropriate IBOutlets.
– Create the IBActions for the Cancel and Save buttons.
Page 1 of 12

– Implement the textFieldShouldReturn method and add a gesture recognizer for the background touch to dismiss the keyboard correctly.
• Update the AddViewController in Storyboard:
– Set the Class in the Identity Inspector.
– Make it the delegate for the Text View and Text Field in the Connections
Inspector.
• Update the TableViewController in Storyboard:
– Create a segue from the Add button to AddViewController. If you added a Navigation Bar in AddViewController, then create a “Present Modally” segue. If you do not have a navigation bar, then create a “Show (e.g. Push)” segue.
• Add data persistence:
– Update the model to add data persistence by saving a plist file to your app’s
Documents folder containing all of the model’s data.
– Verify that it works through the user interface.
– Also verify that the file has been create/updated in the correct folder.
In the init method in your file, print the file path to the console. Using Finder, find your app folder that was printed out in console window using the path logged above. In Finder, you can press the Shift-Command-G keys and enter the path in the text field. Look in the Documents folder. You should see a plist file.
– You should also check whether a plist already has been created for your model. If so, then read in the cards from the plist. If not, then create the cards like you did before.
• Update your cards User Interface:
– Your model should already handle the deletion of all cards without crashing,
but double check to make sure.
– Now, update the class for the Question tab to handle no cards. Display an
appropriate message such as “There are no more flashcards.” for a single tap
and “Please add more flashcards.” for a double tap.
– You should also make sure double tapping on an answer goes back to a
question, if this was not already done in App2.
– Looping around your cards when you read the end or the beginning is
something you should also implement.
– Make sure to check the bounds of the index you pass into your functions. An
invalid input will cause your program to crash.
Submission
• Compress your project folder.
• Rename the zip to LastFirstApp3.zip where Last is your last name and First is
your first/preferred name.
Page 2 of 12

• You will be penalized if the zip is not named correctly or if the project is not submitted correctly for the grader to grade on their computer.
• Submit the .zip file on Blackboard under Assignments.
Grading (20 pts)
• Add new flashcard: 10 pts
– 5 for enable/disable Save button (text in text view and text field)
• Save should be disabled if all sections have not been filled in – 5 for adding to model
• Must add the new card to the list of flashcards correctly
• When navigating back to the table, the new flashcard should be displayed
• Data persistence: 10 pts
– If a plist file exists in the Documents directory, then the model loads the data. If not, model creates at least 5 flashcards.
Additional Extra Credit (10 pts)
• Add Favorites to the tab bar.
• Add a favorites view controller to display the favorites in a table view.
• Be able to add and remove favorites. One way to do this is to add an image or
use a swipe gesture (up or down) on the Questions tab.
• Update the model accordingly.
• You will probably want to save when you add/remove favorites.
** Do not share your code with other students. Do not accept code from other students. If you need help, ask a TA or instructor. **
Page 3 of 12

Important Notes
• Make sure your project compiles and works. Once you have submitted your project on Blackboard, download it and put the zip in a different folder from the location of your original project. Unzip your file and test your project.
• Code quality should be good with helper functions as necessary, no legitimate compiler warnings, and no blocks of repeated copy-pasted code or chunks of unused commented code. Consistent style and indentation is also a good practice to get in the habit of. Points will be deducted for these issues.
– If your code is clear and easy to follow, it’s easier for us to give more partial credit if something were to go wrong, so it’s in your best interest to make your code readable.
• Your name should still appear in the top of each file.
• You cannot reuse the lecture week’s project or sample project for your homework.
• We reserve the right to deduct points if your implementation is unsatisfactory.
• Please follow the spirit of the project.
• If you would like to deviate slightly from these guidelines, please check with us
before doing so, even if your way requires more work. We can sometimes make exceptions but want to ensure you’re able to receive points for the items we are looking to assess in this assignment.
• If you have a bug in your assignment that makes it difficult or impossible to test, we will not fix the bug to test your app and you will not receive points for features we cannot test.
• You are responsible for testing your app thoroughly on all supported devices before submission. We are happy to help work through issues and check against the rubric in office hours, but cannot be responsible for all of your testing prior to grading.
• If you have concerns about your grade, make a private post on Piazza or visit Office Hours. Regrade requests can result in a change in your grade either up or down, if we find something we missed in the previous grading.
• You have one week from when the assignment was graded to dispute the grade.
• Copying someone else’s code is a violation of academic integrity policies and you will be reported. It is trivial for us to tell a project has been copied, in part or in full.
Page 4 of 12

Example
Question Tab Cards Tab
Page 5 of 12

Edit touched Minus icon touched for first element
Page 6 of 12

Delete button touched Model and Table is updated
Page 7 of 12

Add button (Plus icon) touched; Save button is disabled; Keyboard appears
Add text in Text View;
Save button is still disabled;
Touch outside of Text View to dismiss keyboard
Page 8 of 12

Add text in Text Field; Save button touched;
Save button is enabled; Model and Table is updated Touch return/done button on keyboard
or outside of Text Field and Text View
to dismiss keyboard
Page 9 of 12

Delete All Cards All cards deleted
Page 10 of 12

Question Tab with Single Tap Question Tab with Double Tap and no cards and no cards
Page 11 of 12

Storyboard
Page 12 of 12