IOS learning material

Swift 4 (first learn limitation of ios .because there is lot of limitation )
*With Reactive Programming and declarative code, you take that away. This results in cleaner, more readable code.
*What are the different app states?
Non-running – The app is not running.
Inactive – The app is running in the foreground, but not receiving events. An iOS app can be placed into an inactive state, for example, when a call or SMS message is received.
Active – The app is running in the foreground, and receiving events.
Background – The app is running in the background, and executing code.
Suspended – The app is in the background, but no code is being executed.
*What is JSON?
*What do you mean by REST?

*Difference between class and struct ?
Classes support inheritance, whereas structures don’t.
reference type vs value type eg
var person1=Person() = “1”
var person2=person1 = “2”
print(person1) //2
print(person2) //2 where Person is struct then it wold be value type

class MyClass {
class var bar: Bar?
struct MyStruct{
static var bar: Bar?
*What are Optionals(?)

*Difference between Optional Chaining and Optional Binding?

why do we have to use UICollectionViewFlowLayout?
Difference between frame and bounds?
What is NSCoder class used for?
What is NSOperationQueue and when should we use it?
What are extensions? Explain the difference between extension and subclassing?
Difference between delegates and NSNotifications?
What are protocols in Swift?
What is interpolation?
Explain type inference in Swift?
Difference between Auto Layout and Adaptive Layout?
Is possible to use an Objective-C framework in Swift?
Explain the different life cycle of UIViewController?
Difference between xib’s and Storyboards.
Explain MVC?
What is MVVM?
what is an app bundle?
Write a sample code for Singleton design pattern?
What is difference between Unit tests and UI Test in Xcode?
Can you make updates to UI from a background thread?
*Difference between let and var keywords in Swift?
What are generics? Can you write generics example code?
Difference between designated and convenience initializer?
*What is DispatchGroup

In terms of Auto Layout inside storyboards this series has already covered quite a few angles: centering views, fixed constraints, aspect ratio, equal heights and widths, fixed heights and widths, class sizes, compression resistance, and hugging priority. But still there are some buttons we haven’t pressed and boxes we haven’t checked.

As noted above, I’ll be looking in the next post at the fine-tuning of constraints through the use of multipliers, ratios, constants and relations. This will be a fairly in-depth post, covering areas that at first seem fairly unimportant but actually blossom into an area of essential knowledge for using Auto Layout. After that I’ll be moving on to write about Alignment Constraints before venturing into an exploration of the newly introduced UIStackView.
*collection view (clean and implemented)

*Attributes in swift
*closures(Closures are self-contained, callable blocks of code that can be stored and passed around), escaping vs. non-escaping closures, capture lists and retain cycles(ARC and weak var)

When a closure is escaping (as marked by the @escaping parameter attribute) it means that it will be stored somehow (either as a property, or by being captured by another closure). Non-escaping closures on the other hand, cannot be stored and must instead be executed directly when used.

*Coca pods
1.viewDidLoad() —view loaded in memory
then viewDidAppear() –view appeared to user ..put your logic here

Create a project .. and go to project from terminal and write
pod init
paste library in pod file
pod install
this will create a project.xcworkspace and click to open the project from this file

install ruby first through rbenv
pod –version
sudo gem install cocoapods
pod setup
sudo gem update
xcode-select –install
pod outdated
pod update
rbenv rehash

*Content Priority Ambiguity error.

*Content Hugging Priority ( content does not want to grow)

*Content Compression Resistance Priority (content does not want to shrink)

*Sibling & Ancestor Constraints
Sibling = a brother or sister.
Ancestor = from whom one is descended.

*Size classes
*trait collection
*Layout inset

*Stack view
Container of some view without auto layout constraint
//Example code
@IBAction func showLabelButtonAction(sender : AnyObject){
let button = sender as! UIButton
button.setTitle(“my title”, forsate: .Normal)
UIView.animateWithDuration(0.3 , animations:{ self.descriptionLabel.hidden = true} )

*Top and bottom layout guide (navigation bar and tab bar)

*Auto layout (much watch)

Auto Layout Tutorial in iOS 11: Getting Started

*Safe area
The Safe Area is the area in between System UI elements which are Status Bar, Navigation Bar and Tool Bar or Tab Bar. So when you add a Status bar to your app, the Safe Area shrink. When you add a Navigation Bar to your app, the Safe Area shrinks again.
*Intrinsic Content Size
Button and label has a content inside and it have a default height and width .it is called Intrinsic Content Size

*Universal Application (Single binary to run application on both iphone and ipad)

*IOS aligned from left(General) to right(specific)
*Object library is where button label and other UI stuff
Model <-> Controller (.swift) <-> View (.storyboard,.xib)

main.storyboard(View) – (action eg. button) @IBAction -> Controller(ViewController.swift)
<- (outlet eg. label) @IBOutlet - <- (outlet and action eg.slider @IBAction,@IBOutlet) -> Two separate variable in ViewController.swift

First responder (UIClasses .When your app receives an event, UIKit automatically directs that event to the most appropriate responder object, known as the first responder )
*Remove keyboard
in button click @IBAction
(lastLine)self.simpleTextField.resignFirstResponder() //will remove the keyboard from screen

For global scope touchesBegan // tab
self.view.endEditing(true) // remove keyboard on global
*View vs ViewController
A view is an object that is drawn to the screen. It may also contain other views (subviews) that are inside it and move with it. Views can get touch events and change their visual state in response. Views are dumb, and do not know about the structure of your application, and are simply told to display themselves in some state.

A view controller is not drawable to the screen directly, it manages a group of view objects. View controllers usually have a single view with many subviews. The view controller manages the state of these views. A view controller is smart, and has knowledge of your application’s inner workings. It tells the dumb view objects what to do and how to show themselves.

A view controller is the glue between your overall application and the screen. It controls the views that it owns according to the logic of your application.

*UITextFieldDelegate-UITextField has delegate methods that are invoked when a certain event occurs.
*mutating keyword – when you’re actually changing the variables in your struct!
*Auto layout Contraints

Top layout guide
–trailing layout guide

Will show a top horizontal bar and button bold/thicker shaped bar
To show landscape bar Assistant Bar -> Preview landscape and portrait view

*See the references for runtime error .Because it wont complain when removing references and error is not explicit
*Double click on top of the project and see the options

*Universal application -the app which is designed for iphone and ipad
*First responder –first element which get the focus usually the view
function self.simpleTextField.resignFirstResponder()


Learning material
1.Data passing form page to page (segue)
2.Web service with image (Alamofire)
for adding http request
3.Class(ref type) / Struct(value type) **Which (struct) is used most in swift 4
4.Protocol (Set of method ,variable optional or required )
5.Closure (definition of method)
6.Table view ,Collection view
7.Delegate (ViewController data passing)
8.Notification center

1.Named parameter
2.Dynamic object model
The insight of object-oriented programming is to combine state and behavior.State simply means data or value.Behavior means action or work or task or operation that the object does.

Let’s take an example of banking system. There are many customers in the bank. So customer is the object.
Each customer has different data such as accountNumber, firstName, lastName, email etc.
For example
Here, 5959494, “Rahul”, “Kumar” and “” is the state or data of customer object.
Each customer can deposit or withdraw amount. So withdraw and deposit is the behavior of the object.

1. string value
let apples = 3
let appleSummary = “I have \(apples) apples.”

2.For loop
for score in individualScores {
if score > 50 {
teamScore += 3
} else {
teamScore += 1

3.Function with named parameter and return type

func greet(name: String, day: String) -> String {
return “Hello \(name), today is \(day).”
greet(“Bob”, “Tuesday”)
// Tuple returned from function
func getGasPrices() -> (Double, Double, Double) {
return (3.59, 3.69, 3.79)
/** Multiple */
func sumOf(numbers: Int…) -> Int {
var sum = 0
for number in numbers {
sum += number
return sum

sumOf(42, 597, 12)

// complete before page 12 of the book

Book link

Posted in IOS

Leave a Reply

Your email address will not be published. Required fields are marked *