Single View Application Project files in detail

 


Now we know how to write a Simple Hello World Application in Swift Programming language. As shown in the below image,  for Single View application would have created multiple files in your project navigator. What are those files for ? Lets see..
project-navigator
Project Navigator
Project Navigator displays all the files related to the project, if it is not visible, click the left top marked - project Navigator icon.
Now lets look into those files in detail.
AppDelegate.Swift
  • It Stands as an entry point to your application
  • It delivers input events by running a loop
  • @UIApplicationMain Atrribute is responsible for above functions.
  • This attribute is also responsible to manage lifecyle of the application
  • App Delegate contains Single Property: Window , which is used to keep track of the window in which app content is drawn, but this is an optional property
var window: UIWindow?
  • Apart from these appdelegate also contains implementation of important methods. These methods
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
func applicationWillResignActive(application: UIApplication)
func applicationDidEnterBackground(application: UIApplication)
func applicationWillEnterForeground(application: UIApplication)
func applicationDidBecomeActive(application: UIApplication)
func applicationWillTerminate(application: UIApplication)

During app transition, appropriate methods in the app delegate are invoked by the application object.
appdelegate
AppDelegate.swift
ViewController.swift
  • This file defines a custom subclass of UIViewController named ViewController
  • This class simply inherits all the behavior defined by UIViewController.
  • To override or extend that behavior, you override the methods defined on UIViewController or implement your own custom methods.
viewcontroller
ViewController.swift
Main.Storyboard
  • A storyboard is a visual representation of the app’s user interface, showing screens of content and the transitions between them.
  • Xcode opens the storyboard in Interface Builder—its visual interface editor—in the editor area
  • You can add label, Textbox or what ever controls required to build your app
  • Below is a story with a label on it.
storyboard
Storyboard

Hope you got to know the below listed information or answers to these question.
  1. What does appdelegate swift do
  2. What does ViewController swift do
  3. Storyboard in swift
  4. Single View application project files
Hope this tutorial helps you to understand Single View applcation Project files in Swift language.


No comments:
Write comments

Popular Posts

Find us on Facebook