Questions for Ios 12
Total Page:16
File Type:pdf, Size:1020Kb
www.YoYoBrain.com - Accelerators for Memory and Learning Questions for iOS 12 Category: Default - (546 questions) iOS 12: 3 kinds of object types classes, stucts and enums iOS 12: 2 ways to declare a variable let one = 1 var two = 2 iOS 12: how to declare a constant let one = 1 iOS 12: how to suppress a function preceded the internal name with an parameter's external name underscore and a space func myFunc( _ x:Int) { } iOS 12: how to use x for internal parameter put external name followed by space before name versus times as external name for parameter definition function fun myFunc( times x:Int) { } iOS 12: how to declare a parameter as add three periods after declaration variadic (can have as many values of this func sayStrings(_ arrayofStrings:String parameter type as desired) ... ) {} iOS 12: how to have a parameter that declare as inout in function declaration modifies the original value of an argument fun removeCharacter( s:inout String) passed in then call function parameter with & in front removeCharacter(s:&x) iOS 12: object used to store user data UserDefaults.standard permanently iOS 12: event for when user touches outside touchesBegan of text field iOS 12: command to remove keyboard in self.view.endEditing(true) touchesBegan event function iOS 12: Event for text field when user hits textFieldShouldReturn return on keyboard iOS 12: how to remove keyboard in textField.resignFirstResponder() textFieldShouldReturn event iOS 12: how to get a map view to a particular map.setRegion( ) area iOS 12: type needed for map.setRegion( ) MKCoordinateRegion iOS 12: 2 types needed for a CLLocationCoordinate2D MKCoordinateRegion MKCoordinateSpan iOS 12: type for map coordinate points CLLocationDegrees iOS 12: type used for map annotations MKPointAnnotation iOS 12: how to add an annotation to MKMap map.addAnnotation(MKPointAnnotation) map iOS 12: type used to recognize a long press UILongPressGestureRecognizer iOS 12: how to add a gesture recognizer to map.addGestureRecognizer() MKMap map iOS 12: what needs to be imported to get CoreLocation user's location iOS 12: what is needed to manage user var locationManager = CLLocationManager() location iOS 12: how to request permission to get locationManager.requestWhenInUseAuthoriz user location with locationManager ation iOS 12: what has to be added to CLLocationManagerDelegate ViewController definition to use CLLocationManager iOS 12: what function is called by locationManager CLLocationManager when user location is received iOS 12: how to look up address from CLGeocoder().reverseGeocodeLocation() coordinates iOS 12: what function gets called before func prepare(for segue: ViewController segue UIStoryboardSeque, sender) iOS 12: what gets called when table row is func tableView(_ tableView: selected UITableView, didSelectRowAt: indexPath: IndexPath) iOS 12: how to make a segue from code performSeque() iOS 12: how to get a table view to reload table.reloadData() information iOS 12: what class must be imported to play AVFoundation sound iOS 12: what do you create to manage var player = AVAudioPlayer() playing sounds iOS 12: how to get the audio resource path var audioPath = for bach.mp3 Bundle.main.path(forResources: "bach", ofType: "mp3") iOS 12: how to get a handle to respond to let swipeRespond = swipe gestures UISwipeGestureRecognizer() iOS 12: how to add gesture recognizer to self.view.addGestureRecognizer() current view iOS 12: function to override in order to catch func motionEnded() shaking after finished iOS 12: create a random number between 0 let randomNumber = arc4random_uniform() and x iOS 12: library to import to interact with CoreData storing structured data iOS 12: how to grab a reference to let appDelegate = AppDelegate UIApplication.shared.delegate as! AppDelegate iOS 12: how to grab reference to CoreData let context = in AppDelegate appDelegate.persistentContainer.viewConte xt iOS 12: how to create a new CoreData let newUser = object NSEntityDescription.insertNewObject() iOS 12: how to create a fetch request for let request = CoreData table Users NSFetchRequest<NSFetchRequestResult>( entityName: "Users") iOS 12: how to create a select restriction on request.predicate = NSPredicate(format: NSFetchRequest "username = %@", "SuzyQ") iOS 12: how to delete a result from a context.delete(result) NSFetchRequestResult context.save() iOS 12: how to run code on main thread DispatchQueue.main.async { when in a callback } iOS 12: how to search for file storage var docPath = directory path NSSearchPathForDirectoriesInDomains(.doc umentDirectory, ) iOS 12: how to create an image from file UIImage(contentsOfFile: filePath) path iOS 12: how to create a URL let url = URL(string: "http://example.com") iOS 12: syntax to grab a URL from web with let task = URLSession.shared.dataTask(with: URLRequest request request) { data, response, error in //code } task.resume() iOS 12: how to build a URL request with URL let request = NSMutableURLRequest(url: url) url iOS 12: object used to show alerts UIAlertController iOS 12: how to add actions to a alertController.addAction(UIAlertAction() ) UIAlertController iOS 12: object used to show activity spinner UIActivityIndicatorView iOS 12: how to show UIActivityIndicatorView view.addSubview(activityIndicator) activityIndicator iOS 12: how to get UIActivityIndicatorView activityIndicator.startAnimating() activityView to start spinning iOS 12: how to stop user from interacting UIApplication.shared.beginIgnoringInteractio with app nEvents() iOS 12: how to resume user being able to UIApplication.shared.endIgnoringInteraction interact with application Events() iOS 12: what class extensions to UINavigationControllerDelegate ViewController do you add to allow picking UIImagePickerControllerDelegate photos from camera roll iOS 12: what object is used to manage UIImagePickerController picking images from camera roll iOS 12: how to show self.present(imagePickerController) UIImagePickerController imagePickerController in ViewController iOS 12: what function returns after user picks func imagePickerController(UIImagePi image using ImagePickerController ckerController, didFinishPickingMediaWithInfo:) iOS 12: 3 ways to show a function doesn't func say(_ s:String) -> void { } return a value func say(_ s:String) -> () {} func say(_ s:String) { } iOS 12: when creating a parameter that the function's signature is its type accepts a function what is type iOS 12: how to create an alias for a typealias function's signature to use in the parameter typealias VoidVoidFunction = () -> () type declaration iOS 12: a standard control that can initiate UIRefreshControl the refreshing of a scroll view's content iOS 12: Controls use the _____ mechanism target-action to report interesting events happening to your code iOS 12: when adding an action method to specify both the action method and an object UIControl, you _______ that defines the method to the addTarget(_:action:for) method iOS 12: to add a subview to another call addSubview method on the superview controller iOS 12: ______ framework provides the UIKit window and view architecture for implementing your interface iOS 12: the _____ object runs your app's UIApplication main event loop and manages your app's overall lifecycle iOS 12: UIKit apps are always in one of five states: ___ iOS 12: when your app transitions from one UIApplicationDelegate state to another, UIKit notifies your app delegate object, an object that conforms to the ____ protocol iOS 12: UIApplicationDelegate method to application(_:willFinishLaunchingWithOption initialize your app's data structures and s:) perform one-time setup tasks iOS 12: UIApplicationDelegate method to application(_:didFinishLaunchingWithOption validate your content, update your app's s:) default user interface and start any tasks iOS 12: how to determine why your app was System supplies the reason for the launch in launched the dictionary object passed to application(_:willFinishLaunchingWithOption s:) and application(_:didFinishLaunchingWithOption s:) methods iOS 12: when your app is launched, UIKit applicationDidBecomeActive(_:) calls your app delegate's ______ method to let you know your app is now active iOS 12: if your app was already running in applicationWillEnterForeground(_:) the background, UIKit calls the _____ method before calling the applicationDidBecomeActive() iOS 12: notification that a user changed your didChangeNotification app's preferences iOS 12: notification that the current language currentLocaleDidChangeNotification or locale settings changed iOS 12: notification when screen mode of a modeDidChangeNotification display changes iOS 12: how are notifications handled when they are queued and delivered when app an app is suspended starts running again iOS 12: when a foreground app moves to the applicationWillResignActive(_:) background, UIKit first calls the _____ method to deactivate the app iOS 12: For a foreground app that is moving applicationDidEnterBackground(_:) to the background, UIKit follows deactivation with a call to ____ method of your app delegate iOS 12: _______ lets your app run Background App Refresh periodically in the background so that it can update its content iOS 12: 3 things to enable Background App 1. Add required Background Modes key to Refresh your info plist file 2. Call the setMinimumBackgroundFetchInterval(_:) method of UIApplication at launch time 3. Implement the application(_:performFetchWithCompletionH andler:) method in app delegate iOS 12: perform any