IOS Development - Swift

IOS Development - Swift

Best Web Development Company Providing the best IOS Tips and tricks .

#UITableview #animation in #swift || #IOS 01/11/2020

#UITableview #animation in #swift || #IOS This is the simple tableview animation to use in iOS mobile applications. Simple easy to use .

#Login #Signup #Animation simple animation easy to use | Core Animation 29/10/2020

#Login #Signup #Animation simple animation easy to use | Core Animation Login/Signup animation easy to use without third part library learn animation here. Get complete code:- [email protected]

08/03/2018

Complete code for DropDown menu

Step 1:- Install this pod (Pod 'DropDown')

Step 2:- Put this code above viewdidload

//For DropDown
let MoredropDown = DropDown()

lazy var dropDowns: [DropDown] = {
return [
self.MoredropDown,
]
}()

Step 3:- Call this function in viewdidload

setupDropDowns()

Step 4:- Make button Action
func btnDropDownAction(_ sender: Any) {
MoredropDown.show()

}


Step 5:- Put this code blow viewdidload

func setupDropDowns() {
setupMoreDropDown()
}

Step 6:- put this function blow step 5 code

//Function For DropDown
func setupMoreDropDown() {
MoredropDown.anchorView = btnDropDown

MoredropDown.bottomOffset = CGPoint(x: 0, y: MoredropDown.bounds.height)

MoredropDown.dataSource = [
“PageName”, “PageName”, “PageName”, “Exit”
]

// Action triggered on selection
MoredropDown.selectionAction = { [unowned self] (index, item) in
//self.btnMore.setTitle(item, for: .normal)
if item == "History"
{
// self.view.makeToast("coming soon", duration: 1, position: .bottom)
let about = self.storyboard?.instantiateViewController(withIdentifier: “StorydoardID”)
self.navigationController?.pushViewController(about!, animated: true)
}
else if item == "Id Activator"
{
// self.view.makeToast("coming soon", duration: 1, position: .bottom)
let about = self.storyboard?.instantiateViewController(withIdentifier: “storyboardId”)
self.navigationController?.pushViewController(about!, animated: true)
}
else if item == "App Rating"
{
let about = self.storyboard?.instantiateViewController(withIdentifier: “StoryBoardID”)
self.navigationController?.pushViewController(about!, animated: true)

}
else if item == "Exit"
{
UIControl().sendAction( (URLSessionTask.suspend), to: UIApplication.shared, for: nil)

}

}

}

18/02/2018

Here are some interview questions ?



1- could you setup Live Rendering ?

The attribute lets Interface Builder perform live updates on a particular view.

2- What is the difference between Synchronous & Asynchronous task ?

Synchronous: waits until the task has completed Asynchronous: completes a task in background and can notify you when complete

3- What Are B-Trees?

B-trees are search trees that provide an ordered key-value store with excellent performance characteristics. In principle, each node maintains a sorted array of its own elements, and another array for its children.

4- What is made up of NSError object?

There are three parts of NSError object a domain, an error code, and a user info dictionary. The domain is a string that identifies what categories of errors this error is coming from.

5- What is Enum ?

Enum is a type that basically contains a group of related values in same umbrella.

6- What is bounding box?

Bounding box is a term used in geometry; it refers to the smallest measure (area or volume) within which a given set of points.

7- Why don’t we use strong for enum property in Objective-C ?

Because enums aren’t objects, so we don’t specify strong or weak here.

8- What is in Objective-C ?

synthesize generates getter and setter methods for your property.

9- What is in Objective-C ?

We use dynamic for subclasses of NSManagedObject. tells the compiler that getter and setters are implemented somewhere else.

10- Why do we use synchronized ?

synchronized guarantees that only one thread can be executing that code in the block at any given time.

11- What is the difference strong, weaks, read only and copy ?

strong, weak, assign property attributes define how memory for that property will be managed.
Strong means that the reference count will be increased and
the reference to it will be maintained through the life of the object
Weak, means that we are pointing to an object but not increasing its reference count. It’s often used when creating a parent child relationship. The parent has a strong reference to the child but the child only has a weak reference to the parent.
Read only, we can set the property initially but then it can’t be changed.
Copy, means that we’re copying the value of the object when it’s created. Also prevents its value from changing.
for more details check this out

12- What is Dynamic Dispatch ?

Dynamic Dispatch is the process of selecting which implementation
of a polymorphic operation that’s a method or a function to call at run time. This means, that when we wanna invoke our methods like object method. but Swift does not default to dynamic dispatch

13- What’s Code Coverage ?

Code coverage is a metric that helps us to measure the value of our unit tests.

14- What’s Completion Handler ?

Completion handlers are super convenient when our app is making an API call, and we need to do something when that task is done, like updating the UI to show the data from the API call. We’ll see completion handlers in Apple’s APIs like dataTaskWithRequest and they can be pretty handy in your own code.
The completion handler takes a chunk of code with 3 arguments:(NSData?, NSURLResponse?, NSError?) that returns nothing: Void. It’s a closure.
The completion handlers have to marked since they are executed some point after the enclosing function has been executed.

15- How to Prioritize Usability in Design ?

Broke down its design process to prioritize usability in 4 steps:
Think like the user, then design the UX.
Remember that users are people, not demographics.
When promoting an app, consider all the situations in which it could be useful.
Keep working on the utility of the app even after launch.

16- What’s the difference between the frame and the bounds?

The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).
The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.

17- What is Responder Chain ?

A ResponderChain is a hierarchy of objects that have the opportunity to respond to events received.

18- What is Regular expressions ?

Regular expressions are special string patterns that describe how to search through a string.

19- What is Operator Overloading ?

Operator overloading allows us to change how existing operators behave with types that both already exist.

20- What is TVMLKit ?

TVMLKit is the glue between TVML, JavaScript, and your native tvOS application.

21- What is Platform limitations of tvOS ?

First, tvOS provides no browser support of any kind, nor is there any WebKit or other web-based rendering engine you can program against. This means your app can’t link out to a web browser for anything, including web links, OAuth, or social media sites.
Second, tvOS apps cannot explicitly use local storage. At product launch, the devices ship with either 32 GB or 64 GB of hard drive space, but apps are not permitted to write directly to the on-board storage.
tvOS app bundle cannot exceed 4 GB.

22- What is Functions ?

Functions let us group a series of statements together to perform some task. Once a function is created, it can be reused over and over in your code. If you find yourself repeating statements in your code, then a function may be the answer to avoid that repetition.
Pro Tip, Good functions accept input and return output. Bad functions set global variables and rely on other functions to work.

23- What is ABI ?

ABIs are important when it comes to applications that use external libraries. If a program is built to use a particular library and that library is later updated, you don’t want to have to re-compile that application (and from the end-user’s standpoint, you may not have the source). If the updated library uses the same ABI, then your program will not need to change.

24- Why is design pattern very important ?

Design patterns are reusable solutions to common problems in software design. They’re templates designed to help you write code that’s easy to understand and reuse. Most common Cocoa design patterns:
Creational: Singleton.
Structural: Decorator, Adapter, Facade.
Behavioral: Observer, and, Memento

25- What is Singleton Pattern ?

The Singleton design pattern ensures that only one instance exists for a given class and that there’s a global access point to that instance. It usually uses lazy loading to create the single instance when it’s needed the first time.

26- What is Facade Design Pattern ?

The Facade design pattern provides a single interface to a complex subsystem. Instead of exposing the user to a set of classes and their APIs, you only expose one simple unified API.

27- What is Decorator Design Pattern ?

The Decorator pattern dynamically adds behaviors and responsibilities to an object without modifying its code. It’s an alternative to subclassing where you modify a class’s behavior by wrapping it with another object.
In Objective-C there are two very common implementations of this pattern: Category and Delegation. In Swift there are also two very common implementations of this pattern: Extensions and Delegation.

28- What is Adapter Pattern ?

An Adapter allows classes with incompatible interfaces to work together. It wraps itself around an object and exposes a standard interface to interact with that object.

29- What is Observer Pattern ?

In the Observer pattern, one object notifies other objects of any state changes.
Cocoa implements the observer pattern in two ways: Notifications and Key-Value Observing (KVO).

30- What is Memento Pattern ?

In Memento Pattern saves your stuff somewhere. Later on, this externalized state can be restored without violating encapsulation; that is, private data remains private. One of Apple’s specialized implementations of the Memento pattern is Archiving other hand iOS uses the Memento pattern as part of State Restoration.

31- Explain MVC

Models — responsible for the domain data or a data access layer which manipulates the data, think of ‘Person’ or ‘PersonDataProvider’ classes.
Views — responsible for the presentation layer (GUI), for iOS environment think of everything starting with ‘UI’ prefix.
Controller/Presenter/ViewModel — the glue or the mediator between the Model and the View, in general responsible for altering the Model by reacting to the user’s actions performed on the View and updating the View with changes from the Model.

32- Explain MVVM

UIKit independent representation of your View and its state. The View Model invokes changes in the Model and updates itself with the updated Model, and since we have a binding between the View and the View Model, the first is updated accordingly.
Your view model will actually take in your model, and it can format the information that’s going to be displayed on your view.
There is a more known framework called RxSwift. It contains RxCocoa, which are reactive extensions for Cocoa and CocoaTouch.

33- How many different annotations available in Objective-C ?

_Null_unspecified, which bridges to a Swift implicitly unwrapped optional. This is the default.
_Nonnull, the value won’t be nil it bridges to a regular reference.
_Nullable the value can be nil, it bridges to an optional.
_Null_resettable the value can never be nil, when read but you can set it to know to reset it. This is only apply property.

34- What is JSON/PLIST limits ?

We create your objects and then serialized them to disk..
It’s great and very limited use cases.
We can’t obviously use complex queries to filter your results.
It’s very slow.
Each time we need something, we need to either serialize or deserialize it.
it’s not thread-safe.

35- What is SQLite limits ?

We need to define the relations between the tables. Define the schema of all the tables.
We have to manually write queries to fetch data.
We need to query results and then map those to models.
Queries are very fast.

36- What is Realm benefits ?

An open-source database framework.
Implemented from scratch.
Zero copy object store.
Fast.

37- How many are there APIs for battery-efficient location tracking ?

There are 3 apis.
Significant location changes — the location is delivered approximately every 500 metres (usually up to 1 km)
Region monitoring — track enter/exit events from circular regions with a radius equal to 100m or more. Region monitoring is the most precise API after GPS.
Visit events — monitor place Visit events which are enters/exits from a place (home/office).

38- What is the Swift main advantage ?

To mention some of the main advantages of Swift:
Optional Types, which make applications crash-resistant
Built-in error handling
Closures
Much faster compared to other languages
Type-safe language
Supports pattern matching

39- Explain generics in Swift ?

Generics create code that does not get specific about underlying data types. Don’t catch this article.

40- Explain lazy in Swift ?

An initial value of the lazy stored properties is calculated only when the property is called for the first time. There are situations when the lazy properties come very handy to developers.

41- Explain what is defer ?

defer keyword which provides a block of code that will be executed in the case when ex*****on is leaving the current scope.

42- How to pass a variable as a reference ?

We need to mention that there are two types of variables: reference and value types. The difference between these two types is that by passing value type, the variable will create a copy of its data, and the reference type variable will just point to the original data in the memory.

43- Why it is better to use higher order functions?

Functions that take another function as a parameter, or return a function, as a result, are known as higher-order functions. Swift defines these functions as CollectionType.
The very basic higher order function is a filter.

44- What is Concurrency ?

Concurrency is dividing up the ex*****on paths of your program so that they are possibly running at the same time. The common terminology: process, thread, multithreading, and others. Terminology;
Process, An instance of an executing app
Thread, Path of ex*****on for code
Multithreading, Multiple threads or multiple paths of ex*****on running at the same time.
Concurrency, Execute multiple tasks at the same time in a scalable manner.
Queues, Queues are lightweight data structures that manage objects in the order of First-in, First-out (FIFO).
Synchronous vs Asynchronous tasks

45- Grand Central Dispatch (GCD)

GCD is a library that provides a low-level and object-based API to run tasks concurrently while managing threads behind the scenes. Terminology;
Dispatch Queues, A dispatch queue is responsible for executing a task in the first-in, first-out order.
Serial Dispatch Queue A serial dispatch queue runs tasks one at a time.
Concurrent Dispatch Queue A concurrent dispatch queue runs as many tasks as it can without waiting for the started tasks to finish.
Main Dispatch Queue A globally available serial queue that executes tasks on the application’s main thread.

46- Readers-Writers

Multiple threads reading at the same time while there should be only one thread writing. The solution to the problem is a readers-writers lock which allows concurrent read-only access and an exclusive write access. Terminology;
Race Condition A race condition occurs when two or more threads can access shared data and they try to change it at the same time.
Deadlock A deadlock occurs when two or sometimes more tasks wait for the other to finish, and neither ever does.
Readers-Writers problem Multiple threads reading at the same time while there should be only one thread writing.
Readers-writer lock Such a lock allows concurrent read-only access to the shared resource while write operations require exclusive access.
Dispatch Barrier Block Dispatch barrier blocks create a serial-style bottleneck when working with concurrent queues.

47- NSOperation — NSOperationQueue — NSBlockOperation

NSOperation adds a little extra overhead compared to GCD, but we can add dependency among various operations and re-use, cancel or suspend them.
NSOperationQueue, It allows a pool of threads to be created and used to execute NSOperations in parallel. Operation queues aren’t part of GCD.
NSBlockOperation allows you to create an NSOperation from one or more closures. NSBlockOperations can have multiple blocks, that run concurrently.
48- KVC — KVO

KVC adds stands for Key-Value Coding. It’s a mechanism by which an object’s properties can be accessed using string’s at runtime rather than having to statically know the property names at development time.
KVO stands for Key-Value Observing and allows a controller or class to observe changes to a property value. In KVO, an object can ask to be notified of any changes to a specific property, whenever that property changes value, the observer is automatically notified.

49- Please explain Swift’s pattern matching techniques

Tuple patterns are used to match values of corresponding tuple types.
Type-casting patterns allow you to cast or match types.
Wildcard patterns match and ignore any kind and type of value.
Optional patterns are used to match optional values.
Enumeration case patterns match cases of existing enumeration types.
Expression patterns allow you to compare a given value against a given expression.

50- What are benefits of Guard ?

There are two big benefits to guard. One is avoiding the pyramid of doom, as others have mentioned — lots of annoying if let statements nested inside each other moving further and further to the right. The other benefit is provide an early exit out of the function using break or using return.

14/11/2017

App LifeCycle For IOS App's (UIApplicationDelegate)

Understand the states and transitions of an iOS
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.
The seven most important application delegate methods
The operating system calls specific methods within the application delegate to facilitate transitioning to and from various states. The seven most important application delegate methods a developer should handle are:

1:- application:willFinishLaunchingWithOptions
Method called when the launch process is initiated. This is the first opportunity to execute any code within the app.

2:- application:didFinishLaunchingWithOptions
Method called when the launch process is nearly complete. Since this method is called is before any of the app's windows are displayed, it is the last opportunity to prepare the interface and make any final adjustments.

3:- applicationDidBecomeActive
Once the application has become active, the application delegate will receive a callback notification message via the method applicationDidBecomeActive.
This method is also called each time the app returns to an active state from a previous switch to inactive from a resulting phone call or SMS.

4:- applicationWillResignActive
There are several conditions that will spawn the applicationWillResignActive method. Each time a temporary event, such as a phone call, happens this method gets called. It is also important to note that "quitting" an iOS app does not terminate the processes, but rather moves the app to the background.

5:-applicationDidEnterBackground
This method is called when an iOS app is running, but no longer in the foreground. In other words, the user interface is not currently being displayed. According to Apple's UIApplicationDelegate Protocol Reference, the app has approximately five seconds to perform tasks and return. If the method does not return within five seconds, the application is terminated.

6:-applicationWillEnterForeground
This method is called as an app is preparing to move from the background to the foreground. The app, however, is not moved into an active state without the applicationDidBecomeActive method being called. This method gives a developer the opportunity to re-establish the settings of the previous running state before the app becomes active.

7:- applicationWillTerminate
This method notifies your application delegate when a termination event has been triggered. Hitting the home button no longer quits the application. Force quitting the iOS app, or shutting down the device triggers the applicationWillTerminate method. This is the opportunity to save the application configuration, settings, and user preferences.

02/08/2014

google pegion update is related to local listing like google maps and it hits to reviews and google plus page u can get more info on search engien land

Telephone

Website