03 May Change the cell layout to use the other two styles. 2. Expand the settings screen to allow for specifying two sort fields. Then have the sortin
1. Change the cell layout to use the other two styles.
2. Expand the settings screen to allow for specifying two sort fields. Then have the sorting be done by first one and then the other field.
3. Choose different fields from the Contact class to display in the table.
4. Change the display in the table to look like this instead: Main label: Superman from Metropolis. Detail Label: Born on: April 18, 1938.
5. Change the app so when the user taps the + button to add a new Contact, the Contact screen is put into edit mode and the cursor placed in the first text field.
6. add a delete button to the Alert Controller, and implement the functionality to delete the chosen contact.
7. Use the destructive style for the button.
8. Add the ability to sort by a secondary field (e.g., sort by name within the city).
9. Find a way to have the picker for the sort field display the fields with uppercase words and the name as Contact Name, rather than contactName.
My Contact List/My Contact List/Constants.swift
// // Constants.swift // My Contact List // // Created by Michael Eierman on 8/6/19. // Copyright © 2019 Learning Mobile Apps. All rights reserved. // import Foundation struct Constants { static let kSortField = "sortField" static let kSortDirectionAscending = "sortDirectionAscending" }
__MACOSX/My Contact List/My Contact List/._Constants.swift
My Contact List/My Contact List/MyContactListModel.xcdatamodeld/MyContactListModel.xcdatamodel/contents
__MACOSX/My Contact List/My Contact List/MyContactListModel.xcdatamodeld/._MyContactListModel.xcdatamodel
__MACOSX/My Contact List/My Contact List/._MyContactListModel.xcdatamodeld
My Contact List/My Contact List/MapViewController.swift
// // MapViewController.swift // My Contact List // // Created by Michael Eierman on 8/5/19. // Copyright © 2019 Learning Mobile Apps. All rights reserved. // import UIKit class MapViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } /* // MARK: – Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }
__MACOSX/My Contact List/My Contact List/._MapViewController.swift
My Contact List/My Contact List/Assets.xcassets/sample-881-globe.imageset/sample-401-globe.png
My Contact List/My Contact List/Assets.xcassets/sample-881-globe.imageset/[email protected]
My Contact List/My Contact List/Assets.xcassets/sample-881-globe.imageset/Contents.json
{ "images" : [ { "idiom" : "universal", "filename" : "sample-401-globe.png", "scale" : "1x" }, { "idiom" : "universal", "filename" : "[email protected]", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }
My Contact List/My Contact List/Assets.xcassets/AppIcon.appiconset/Contents.json
{ "images" : [ { "idiom" : "iphone", "size" : "20×20", "scale" : "2x" }, { "idiom" : "iphone", "size" : "20×20", "scale" : "3x" }, { "idiom" : "iphone", "size" : "29×29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29×29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40×40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40×40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60×60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60×60", "scale" : "3x" }, { "idiom" : "ipad", "size" : "20×20", "scale" : "1x" }, { "idiom" : "ipad", "size" : "20×20", "scale" : "2x" }, { "idiom" : "ipad", "size" : "29×29", "scale" : "1x" }, { "idiom" : "ipad", "size" : "29×29", "scale" : "2x" }, { "idiom" : "ipad", "size" : "40×40", "scale" : "1x" }, { "idiom" : "ipad", "size" : "40×40", "scale" : "2x" }, { "idiom" : "ipad", "size" : "76×76", "scale" : "1x" }, { "idiom" : "ipad", "size" : "76×76", "scale" : "2x" }, { "idiom" : "ipad", "size" : "83.5×83.5", "scale" : "2x" }, { "idiom" : "ios-marketing", "size" : "1024×1024", "scale" : "1x" } ], "info" : { "version" : 1, "author" : "xcode" } }
My Contact List/My Contact List/Assets.xcassets/second.imageset/second.pdf
My Contact List/My Contact List/Assets.xcassets/second.imageset/Contents.json
{ "images" : [ { "idiom" : "universal", "filename" : "second.pdf" } ], "info" : { "version" : 1, "author" : "xcode" } }
__MACOSX/My Contact List/My Contact List/Assets.xcassets/second.imageset/._Contents.json
My Contact List/My Contact List/Assets.xcassets/first.imageset/Contents.json
{ "images" : [ { "idiom" : "universal", "filename" : "first.pdf" } ], "info" : { "version" : 1, "author" : "xcode" } }
__MACOSX/My Contact List/My Contact List/Assets.xcassets/first.imageset/._Contents.json
My Contact List/My Contact List/Assets.xcassets/first.imageset/first.pdf
My Contact List/My Contact List/Assets.xcassets/Contents.json
{ "info" : { "version" : 1, "author" : "xcode" } }
My Contact List/My Contact List/Assets.xcassets/sample-834-bolt.imageset/[email protected]
My Contact List/My Contact List/Assets.xcassets/sample-834-bolt.imageset/Contents.json
{ "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "idiom" : "universal", "filename" : "[email protected]", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }
My Contact List/My Contact List/ContactsViewController.swift
// // ContactsViewController.swift // My Contact List // // Created by Michael Eierman on 8/5/19. // Copyright © 2019 Learning Mobile Apps. All rights reserved. // import UIKit import CoreData class ContactsViewController: UIViewController, UITextFieldDelegate, DateControllerDelegate { var currentContact: Contact? let appDelegate = UIApplication.shared.delegate as! AppDelegate @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var txtName: UITextField! @IBOutlet weak var txtAddress: UITextField! @IBOutlet weak var txtCity: UITextField! @IBOutlet weak var txtState: UITextField! @IBOutlet weak var txtZip: UITextField! @IBOutlet weak var txtCell: UITextField! @IBOutlet weak var txtPhone: UITextField! @IBOutlet weak var txtEmail: UITextField! @IBOutlet weak var lblBirthdate: UILabel! @IBOutlet weak var btnChange: UIButton! @IBOutlet weak var sgmtEditMode: UISegmentedControl! @IBAction func changeEditMode(_ sender: Any) { let textFields: [UITextField] = [txtName, txtAddress, txtCity, txtState, txtZip, txtPhone, txtCell, txtEmail] if sgmtEditMode.selectedSegmentIndex == 0 { for textField in textFields { textField.isEnabled = false textField.borderStyle = UITextField.BorderStyle.none } btnChange.isHidden = true navigationItem.rightBarButtonItem = nil } else if sgmtEditMode.selectedSegmentIndex == 1{ for textField in textFields { textField.isEnabled = true textField.borderStyle = UITextField.BorderStyle.roundedRect } btnChange.isHidden = false navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save, target: self, action: #selector(self.saveContact)) } } func textFieldShouldEndEditing(_ textField: UITextField) -> Bool { if currentContact == nil { let context = appDelegate.persistentContainer.viewContext currentContact = Contact(context: context) } currentContact?.contactName = txtName.text currentContact?.streetAddress = txtAddress.text currentContact?.city = txtCity.text currentContact?.state = txtState.text currentContact?.zipCode = txtZip.text currentContact?.cellNumber = txtCell.text currentContact?.phoneNumber = txtPhone.text currentContact?.email = txtEmail.text return true } @objc func saveContact() { appDelegate.saveContext() sgmtEditMode.selectedSegmentIndex = 0 changeEditMode(self) } override func viewDidLoad() { super.viewDidLoad() if currentContact != nil { txtName.text = currentContact!.contactName txtAddress.text = currentContact!.streetAddress txtCity.text = currentContact!.city txtState.text = currentContact!.state txtZip.text = currentContact!.zipCode txtPhone.text = currentContact!.phoneNumber txtCell.text = currentContact!.cellNumber txtEmail.text = currentContact!.email let formatter = DateFormatter() formatter.dateStyle = .short if currentContact!.birthday != nil { lblBirthdate.text = formatter.string(from: currentContact!.birthday!) } } self.changeEditMode(self) let textFields: [UITextField] = [txtName, txtAddress, txtCity, txtState, txtZip, txtPhone, txtCell, txtEmail] for textfield in textFields { textfield.addTarget(self, action: #selector(UITextFieldDelegate.textFieldShouldEndEditing(_:)), for: UIControl.Event.editingDidEnd) } } func dateChanged(date: Date) { if currentContact == nil { let context = appDelegate.persistentContainer.viewContext currentContact = Contact(context: context) } currentContact?.birthday = date let formatter = DateFormatter() formatter.dateStyle = .short lblBirthdate.text = formatter.string(from: date) } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.registerKeyboardNotifications() } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) self.unregisterKeyboardNotifications() } func registerKeyboardNotifications() { NotificationCenter.default.addObserver(self, selector: #selector(ContactsViewController.keyboardDidShow(notification:)), name: UIResponder.keyboardDidShowNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(ContactsViewController.keyboardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil) } func unregisterKeyboardNotifications() { NotificationCenter.default.removeObserver(self) } @objc func keyboardDidShow(notification: NSNotification) { let userInfo: NSDictionary = notification.userInfo! as NSDictionary let keyboardInfo = userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as! NSValue let keyboardSize = keyboardInfo.cgRectValue.size // Get the existing contentInset for the scrollView and set the bottom property to //be the height of the keyboard var contentInset = self.scrollView.contentInset contentInset.bottom = keyboardSize.height self.scrollView.contentInset = contentInset self.scrollView.scrollIndicatorInsets = contentInset } @objc func keyboardWillHide(notification: NSNotification) { var contentInset = self.scrollView.contentInset contentInset.bottom = 0 self.scrollView.contentInset = contentInset self.scrollView.scrollIndicatorInsets = UIEdgeInsets.zero } /* // MARK: – Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if(segue.identifier == "segueContactDate"){ let dateController = segue.destination as! DateViewController dateController.delegate = self } } }
__MACOSX/My Contact List/My Contact List/._ContactsViewController.swift
My Contact List/My Contact List/Base.lproj/LaunchScreen.storyboard
__MACOSX/My Contact List/My Contact List/Base.lproj/._LaunchScreen.storyboard
My Contact List/My Contact List/Base.lproj/Main.storyboard
__MACOSX/My Contact List/My Contact List/Base.lproj/._Main.storyboard
My Contact List/My Contact List/AppDelegate.swift
// // AppDelegate.swift // My Contact List // // Created by Michael Eierman on 8/2/19. // Copyright © 2019 Learning Mobile Apps. All rights reserved. // import UIKit import CoreData @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let settings = UserDefaults.standard if settings.string(forKey: Constants.kSortField) == nil { settings.set("city", forKey: Constants.kSortField) } if settings.string(forKey: Constants.kSortDirectionAsce
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteEdu. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
Do you need help with this question?
Get assignment help from WriteEdu.com Paper Writing Website and forget about your problems.
WriteEdu provides custom & cheap essay writing 100% original, plagiarism free essays, assignments & dissertations.
With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Chat with us today! We are always waiting to answer all your questions.