Build Twitter with REST API and JSON (Search and Fetch New Tweets from Twitter)

[ad_1]
FREE DOWNLOAD:

In this episode, you will learn how to use a custom Twitter framework to search for new tweets from any user, hashtag or keywords.

Along the way, you are going to learn how to structure your data model so your app will adapt with new data coming in real time.

First off, let’s download the starter project Duc prepared for you. Just simply enter your name and email on the page to get:
+ the starter and complete projects of this episode
+ Duc’s step-by-step video tutorial
+ Duc’s new training on How to Build Nike E-commerce Store WITHOUT Losing Your Shirt

It’s all awesome iOS development training for you, for FREE!

FREE DOWNLOAD:

*********
ABOUT CODE MASTERY
*********
Code Mastery is hosted by Duc Tran, founder of Developers Academy.

This is his free-style no notes, no teleprompter presentation and live coding broadcast with you guys everyday.

To join Duc’s free courses, register for free at

*********
MEET DUC TRAN
*********

Duc Tran is founder of Developers Academy, one of the world’s leading iOS, Android and Web development trainers.

More than 2,000,000 developers have studied his video trainings; 100,000 developers see his posts each month. Each year, Duc has helped 20,000 plus developers graduate from his online courses or video series.

*********
FREE TRAININGS IN IOS DEVELOPMENT
*********
To subscribe and get free tutorials, courses and weekly content, visit me at:
Connect with Duc on facebook:
Tweet him:
Get daily inspiration:

*********
SOURCE CODE IN THIS COURSE
*********

NetworkProcessor.swift

class NetworkProcessor
{
lazy var configuration: URLSessionConfiguration = URLSessionConfiguration.default
lazy var session: URLSession = URLSession(configuration: self.configuration)

let url: URL

init(url: URL)
{
self.url = url
}

typealias JSONDictionaryHandler = (([String : Any]?) – Void)

func downloadJSONFromURL(_ completion: @escaping JSONDictionaryHandler)
{
let request = URLRequest(url: self.url)
let dataTask = session.dataTask(with: request) { (data, response, error) in

if error == nil {

if let httpResponse = response as? HTTPURLResponse {
switch httpResponse.statusCode {
case 200:
// successful response
if let data = data {
do {
let jsonDictionary = try JSONSerialization.jsonObject(with: data, options: .mutableContainers)

completion(jsonDictionary as? [String : Any])

} catch let error as NSError {
print(“Error processing json data: (error.localizedDescription)”)
}

}

default:
print(“HTTP Reponse Code: (httpResponse.statusCode)”)
}
}

} else {
print(“Error: (error?.localizedDescription)”)
}
}

dataTask.resume()
}
}

Full access to source code:

Episode tags: duc tran, ductran.co, developers academy, REST, REST API, REST API in ios tutorial, ios REST API, how to parse json, parse json in ios, parse json, parse json swift, parse json swift tutorial, parse json in Swift, alamofire, alamofire tutorial, uicollectionview, json ios, ios json parsing, ios json, ios json tutorial, json swift tutorial, swift json tutorial, parse json in ios,swiftyjson, nsurlsession, urlsession, firebase, alamofire, alamofire tutorial, alamofire swift tutorial


Posted

in

by

Tags:

Comments

7 responses to “Build Twitter with REST API and JSON (Search and Fetch New Tweets from Twitter)”

  1. Kelly Lee Avatar

    Hello I got this error at around 41 mins in your video. How can I get rid of it? Thanks!

    "TwitterRequest: Couldn't discover Twitter account type."
    Optional([[]])

  2. Ade Suluh Avatar

    Best ios channel in youtube so far to me, keep the good work, dude!
    anyway, do you have any plans for layouting ios with XIB ? it would be great 🙂 thanks!

  3. MedoMan Avatar

    Can you do a tutorial on rating things on swift, but firstly, the app retrieves JSON data from a website, please? Anyway great tutorial, thanks.

  4. Ade Adegoke Avatar

    @Duc Tran, why do start your tutorials having done some of it already. I do not want to download the starter pack. I want learn and understand every single aspect of the tutorial. I want to watch the tutorials from the absolute beginning.

  5. Gabriel Cantarin Avatar

    I guess there's a bug in the link when I try to download it .. =/

Leave a Reply

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