Friday, 31 March 2017

Collection View using Prototype Cell (Swift3)

Collection View using Swift3







Thursday, 30 March 2017

Prototype Table & Progress Bar (Swift3)

Prototype Table using Swift3 

Download Code



Progress Bar using Swift3 

Download Code





Friday, 24 March 2017

Using CocoaPods in Your Swift3 and Objective-C Projects


Step 1 - 

Open Terminal

sudo gem install cocoapods


Step 2 -
cd ~/Desktop/CocoapodsTest
 
Step 3 -
 pod init

Step 4 -    CocoaPod then generates the Podfile in project folder like this :
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'CocoapodsTest' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  # Pods for CocoapodsTest
end

 Step 5 - Type the following command to open the file with vim:
vim Podfile
  
 Step 6 -
Suppose you’re going to use Firebase in your Xcode project. To do so, edit the file content like this to configure the Firebase pod.
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'CocoapodsTest' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  # Pods for CocoapodsTest
  pod 'Firebase'
end
  
 Step 7 - That’s it. To exit vim, hit the escape key and then type: 
:wq
  
Step 8 -

pod install



 Step 9 -
  
So from now on, you have to use ProjectName.xcworkspace instead of ProjectName.xcodeproj.
 



 Step 10 -

Now all there’s left to do is use the Firebase pod. Let’s navigate back to Xcode and inside the IDE, go to ViewController.swift. At the top, type:


import Firebase


* And look at that! You are up and running with CocoaPods!

# For more in detail refer link 

Tuesday, 14 March 2017

Alert Controller navigating to another New View (Swift3)

//*************** Alert Controller ***************//

@IBAction func btnAlertAction(_ sender: Any)
{
   
let alertActionSheet = UIAlertController(title: "Menu", message: "",
preferredStyle: .alert)
       
       
let oneAction = UIAlertAction(title: "One", style: .default, handler: { action in self.performSegue(withIdentifier: "mySegueIdentifierOne", sender: self) })
       
let twoAction = UIAlertAction(title: "Two", style: .default, handler: { action in self.performSegue(withIdentifier: "mySegueIdentifierTwo", sender: self) })
  
let closeAction = UIAlertAction(title: "Close", style: .cancel, handler: { action in print("Close")
        })
       
        alertActionSheet.addAction(closeAction)
        alertActionSheet.addAction(oneAction)
        alertActionSheet.addAction(twoAction)

 self.present(alertActionSheet, animated: true)
}


# Note

1. Create Outlet first

2. Create Action Button & write above code

3.  You could create a segue in your storyboard, control dragging from the yellow view controller at
      the top of a scene to a new view controller. Then give that segue an identifier in the inspector. You
      can call that from the handler in your code.

4. If you don't need title of Alert controller use below code

            alertActionSheet.title = nil
          alertActionSheet.message = nil

Action Controller navigating to another New View (Swift3)

//*************** Alert  Action  Controller ***************//

@IBAction func btnAlertAction(_ sender: Any)
{
   
let alertActionSheet = UIAlertController(title: "Menu", message: "",
preferredStyle: .actionSheet)
       
       
let oneAction = UIAlertAction(title: "One", style: .default, handler: { action in self.performSegue(withIdentifier: "mySegueIdentifierOne", sender: self) })
       
let twoAction = UIAlertAction(title: "Two", style: .default, handler: { action in self.performSegue(withIdentifier: "mySegueIdentifierTwo", sender: self) })
  
let closeAction = UIAlertAction(title: "Close", style: .cancel, handler: { action in print("Close")
        })
       
        alertActionSheet.addAction(closeAction)
        alertActionSheet.addAction(oneAction)
        alertActionSheet.addAction(twoAction)

 self.present(alertActionSheet, animated: true)
}

# Note :- You could create a segue in your storyboard, control dragging from the yellow view controller at the top of a scene to a new view controller. Then give that segue an identifier in the inspector. You can call that from the handler in your code.