Skip to main content

Posts

Instantly parse JSON

You must know about the JSON  . Don't worry I am not here to teach this because I am not a good teacher 😉. If you are really interested to learn about it then just search on the Google or check   Parsing complex JSON in Flutter  (Personally recommended) because she covers almost all things. Now, do you have time to write such classes in such a digital age?? Great 👍 then just see  https://app.quicktype.io/ . Really a good job 👏 What you need to do  Copy JSON   Paste in JSON area Give the Model name Copy code Let me explain it to you. They have a text area in which you need to copy the JSON and then Copy the dart code. They also have other language support also.  Thanks.  Please comment below how I can improve this article
Recent posts

Use Flutter Dependencies as Local Package

  Pub.dev is a very cool tool in the Flutter world and every flutterian must knows about it. You just need to write the package in pubspec.yaml file  YAML Langauge  and run pub get that's it. Wow so cool! The main benefit of this is that your project will always get sync with the mention version in the pubspec file.  But sometimes we also want to use Dependency as a local code. Let me tell you a way I am going to use  flutter_share: ^1.0.2+1 pubspec.yaml file with flutter share dependencies from pub.dev Step 1. Find dependency in the Dart package folder of External Library Step 2. Find the same folder in your Finder/File explorer   Step 3. Move dependency to the root folder of the project Step 4. Rename to something unique so that pubspec cache identifies that folder as unique. I like to replace "."(dot) with "_" (Underscore)  Step 5. Change the path in pubspec.yaml file Final Step. Run pub get... :) Note: - 1.  Don't forget to set th...

Passing Data Between ViewControllers

override func prepare ( for segue: UIStoryboardSegue, sender: Any?) { let controller = segue.destination as ! DestinationVC controller.firstValue = randomDiceValue() //Any Function to perform controller.secondValue = randomDiceValue() //Any Function } This Will help to send Data from One segue to the Another Explanation In This, we Override a func called prepare override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "rollDice" { let controller = segue.destination as! DiceViewController controller.firstValue = randomDiceValue() controller.secondValue = randomDiceValue() } } You might be wondering what that if statement is doing. When you start building more complex apps, at some point you’ll have more than one segue associated with the same viewController. In this case, you will need to use the segue identifier to check which segue is being called. Here, of course, we’re checking to see...

Launch Activity View And Alert View

import UIKit class ViewController : UIViewController { 1. @IBAction func experiment ( _ sender: Any) { 2. let image = UIImage () 3. let controller = UIActivityViewController (activityItems: [image],applicationActivities: nil ) 4. self .present(controller, animated: true , completion: nil ) } } Step 3: Make a object of controller for the Activity class Launch Alert View import UIKit class ViewController : UIViewController { @IBAction func experiment ( _ sender: Any) { let controller = UIAlertController () controller.title = "Test Alert" controller.message = "This is a test" let okAction = UIAlertAction<br /> (title: "ok" , style: UIAlertActionStyle . default ) { action in self .dismiss(animated: true , completion: nil ) } controller.addAction(okAction) self .present(controlle...

How to Go in Image Gallery

 UIImagePickerController() Implementing of that method Step 2: Add import UIKit   class ViewController: UIViewController {  override func viewDidLoad() {               super.viewDidLoad()                              }  @IBAction func experiment  (_ sender: UIButton) {   // Button Action  let nextController = UIImagePickerController()  // Make a constant for using the method  self.present(nextController, animated: true, completion: nil)   //Using the "present" function   }  }  Launch Image Picker And Activity View Steps to build a simple app that launches an imagePicker: Step 1: Create a new project using the Single View Application Template Step 2: Add @IBAction func experiment () { } to the ViewController.swift file Step 3: In Storyboard, open up t...

Popular posts from this blog