SlideShare a Scribd company logo
Implementasi REST API di
iOS menggunakan
Alamofire dan SwiftyJSON
Pembicara
Zamaludin Abdulah
iOS Dev. & Tech Lead GITS Indonesia
Moderator
M. Arif Rahman
iOS Dev. & Content Creator GITS Indonesia
REST API ANALOGI
Alamofire & SwiftyJSON Analogy
Apa itu Alamofire?
Alamofire merupakan library eksternal untuk melakukan transaksi dan koneksi data ke server di dalam
aplikasi iOS/MacOS. Library ini dibangun dalam sistem pemuatan URL dari Apple yang disediakan oleh foundation
framework. Alamofire lebih mudah digunakan dan menyediakan berbagai fungsionalitas yang diperlukan untuk
pengembangan aplikasi menggunakan jaringan HTTP.
Alamofire VS URLSession
Kenapa membutukan alamofire
kalau sudah ada fungsi bawaan
Apple bernama URLSession
Alamofire VS URLSession
● Lebih elegan
● Lebih mudah dimengerti dan digunakan
● Baris Coding lebih singkat
● Development lebih cepat
Pros and Cons Alamofire
● Tidak adaptif terhadap perkembangan
bahasa pemrograman (Hal umum)
● Sering terjadi perubahan dimasa depan
Pros : Cons :
Alamofire
● 219 contributors
● 30K+ stars
● 42+ million (!!) downloads according to CocoaPods stats and 600K+ apps which are
using it
● Lebih adaptif dengan bahasa pemrograman swift
karena URLSession adalah default dari Apple
● Tidak ketergantungan dengan library
Pros and Cons URLSession
● Melalui proses yang lebih panjang
● Memperlambat proses development
● Lebih sulit dipahami dan digunakan
Pros : Cons :
SwiftyJSON
SwiftyJSON adalah library yang membantu membaca dan memproses data JSON dari API / Server. Jadi
mengapa menggunakan SwiftyJSON? Swift sangat ketat mengenai tipe data dan harus dinyatakan secara eksplisit
sehingga diperlukan SwiftyJSON untuk mempermudah mengelola data.
SwiftyJSON VS JSONSerialization
let json = JSON(data: dataFromNetworking)
if let userName = json[0]["user"]["name"].string {
//Now you got your value
}
if let statusesArray = try?
JSONSerialization.jsonObject(with: data,
options: .allowFragments) as? [[String: Any]],
let user = statusesArray[0]["user"] as?
[String: Any],
let username = user["name"] as? String {
// Finally we got the username
}
● Lebih mudah ketika berhadapan dengan pengolahan
data JSON
● Lebih mudah dimengerti dan digunakan
● Baris Coding lebih singkat
● Development lebih cepat
Pros and Cons SwiftyJSON
● Tidak adaptif terhadap perkembangan
bahasa pemrograman (Hal umum)
● Sering terjadi perubahan dimasa depan
Pros : Cons :
DEMO
Sample Code :
https://github.com/ios-dev-bdg/alamofire-sample
Tools yang dibutuhkan
● Xcode
● Cocoapod
● Terminal
Generate JSON ke Model Swift
Menggunakan JSONCafe.com
Get Data List Movie
Thank You

More Related Content

Similar to GITS Webinar: Implementasi REST API di iOS Menggunakan Alamofire dan SwiftyJSON

Tugas 1 rekayasa web
Tugas 1 rekayasa webTugas 1 rekayasa web
Tugas 1 rekayasa web
Nasrul Akbar
 
Tugas 1
Tugas 1Tugas 1
Tugas 1
nurul azmi
 
Tugas 1
Tugas 1Tugas 1
Tugas 1
nurul azmi
 
Tugas 2 0317-nurul azmi-1412510587
Tugas 2 0317-nurul azmi-1412510587Tugas 2 0317-nurul azmi-1412510587
Tugas 2 0317-nurul azmi-1412510587
nurul azmi
 
Tugas rekweb 0316 arifmunandar 1312510124
Tugas rekweb 0316 arifmunandar 1312510124Tugas rekweb 0316 arifmunandar 1312510124
Tugas rekweb 0316 arifmunandar 1312510124
arief munandar
 
Tugas 4 rekayasa web
Tugas 4 rekayasa webTugas 4 rekayasa web
Tugas 4 rekayasa web
muslim rohadi
 
Rekayasa web tugas 4
Rekayasa web  tugas 4Rekayasa web  tugas 4
Rekayasa web tugas 4
yuyun kuratu
 
Tugas 4 rekayasa web 1312510231 rostarina.h
Tugas 4 rekayasa web 1312510231 rostarina.hTugas 4 rekayasa web 1312510231 rostarina.h
Tugas 4 rekayasa web 1312510231 rostarina.h
osta92
 
Tugas 4 rekayasa web
Tugas 4 rekayasa webTugas 4 rekayasa web
Tugas 4 rekayasa web
Mohammad Arief
 
Tugas 4
Tugas 4Tugas 4
Tugas 1 (rekayasa web)
Tugas 1 (rekayasa web)Tugas 1 (rekayasa web)
Tugas 1 (rekayasa web)
Linda Lestari
 
Tugas 1 rekweb-0317
Tugas  1 rekweb-0317Tugas  1 rekweb-0317
Tugas 1 rekweb-0317
esti setiasih
 
Tugas 4 Rekayasa Web
Tugas 4 Rekayasa WebTugas 4 Rekayasa Web
Tugas 4 Rekayasa Web
Sugianto oo
 
Tugas 2 0317-fahreza yozi-1612510832
Tugas 2 0317-fahreza yozi-1612510832Tugas 2 0317-fahreza yozi-1612510832
Tugas 2 0317-fahreza yozi-1612510832
fahreza yozi
 
Perkembangan web server di Linux
Perkembangan web server di LinuxPerkembangan web server di Linux
Perkembangan web server di LinuxTugas_SO2
 
Tugas 4 - Rekayasa Web
Tugas 4 - Rekayasa WebTugas 4 - Rekayasa Web
Tugas 4 - Rekayasa Web
arisjunedi
 
Tugas[1] 0317-[tryanita]-[1411511676]
Tugas[1] 0317-[tryanita]-[1411511676]Tugas[1] 0317-[tryanita]-[1411511676]
Tugas[1] 0317-[tryanita]-[1411511676]
trya nita
 
Tugas 4 rekayasa web 0316
Tugas 4 rekayasa web 0316Tugas 4 rekayasa web 0316
Tugas 4 rekayasa web 0316
art david
 
Rekayasa web
Rekayasa webRekayasa web
Rekayasa web
reksa eka
 
Tugas4 [ku]-0316-kahfi arif akbar-1012501571
Tugas4 [ku]-0316-kahfi arif akbar-1012501571Tugas4 [ku]-0316-kahfi arif akbar-1012501571
Tugas4 [ku]-0316-kahfi arif akbar-1012501571
kahfi ariep akbar
 

Similar to GITS Webinar: Implementasi REST API di iOS Menggunakan Alamofire dan SwiftyJSON (20)

Tugas 1 rekayasa web
Tugas 1 rekayasa webTugas 1 rekayasa web
Tugas 1 rekayasa web
 
Tugas 1
Tugas 1Tugas 1
Tugas 1
 
Tugas 1
Tugas 1Tugas 1
Tugas 1
 
Tugas 2 0317-nurul azmi-1412510587
Tugas 2 0317-nurul azmi-1412510587Tugas 2 0317-nurul azmi-1412510587
Tugas 2 0317-nurul azmi-1412510587
 
Tugas rekweb 0316 arifmunandar 1312510124
Tugas rekweb 0316 arifmunandar 1312510124Tugas rekweb 0316 arifmunandar 1312510124
Tugas rekweb 0316 arifmunandar 1312510124
 
Tugas 4 rekayasa web
Tugas 4 rekayasa webTugas 4 rekayasa web
Tugas 4 rekayasa web
 
Rekayasa web tugas 4
Rekayasa web  tugas 4Rekayasa web  tugas 4
Rekayasa web tugas 4
 
Tugas 4 rekayasa web 1312510231 rostarina.h
Tugas 4 rekayasa web 1312510231 rostarina.hTugas 4 rekayasa web 1312510231 rostarina.h
Tugas 4 rekayasa web 1312510231 rostarina.h
 
Tugas 4 rekayasa web
Tugas 4 rekayasa webTugas 4 rekayasa web
Tugas 4 rekayasa web
 
Tugas 4
Tugas 4Tugas 4
Tugas 4
 
Tugas 1 (rekayasa web)
Tugas 1 (rekayasa web)Tugas 1 (rekayasa web)
Tugas 1 (rekayasa web)
 
Tugas 1 rekweb-0317
Tugas  1 rekweb-0317Tugas  1 rekweb-0317
Tugas 1 rekweb-0317
 
Tugas 4 Rekayasa Web
Tugas 4 Rekayasa WebTugas 4 Rekayasa Web
Tugas 4 Rekayasa Web
 
Tugas 2 0317-fahreza yozi-1612510832
Tugas 2 0317-fahreza yozi-1612510832Tugas 2 0317-fahreza yozi-1612510832
Tugas 2 0317-fahreza yozi-1612510832
 
Perkembangan web server di Linux
Perkembangan web server di LinuxPerkembangan web server di Linux
Perkembangan web server di Linux
 
Tugas 4 - Rekayasa Web
Tugas 4 - Rekayasa WebTugas 4 - Rekayasa Web
Tugas 4 - Rekayasa Web
 
Tugas[1] 0317-[tryanita]-[1411511676]
Tugas[1] 0317-[tryanita]-[1411511676]Tugas[1] 0317-[tryanita]-[1411511676]
Tugas[1] 0317-[tryanita]-[1411511676]
 
Tugas 4 rekayasa web 0316
Tugas 4 rekayasa web 0316Tugas 4 rekayasa web 0316
Tugas 4 rekayasa web 0316
 
Rekayasa web
Rekayasa webRekayasa web
Rekayasa web
 
Tugas4 [ku]-0316-kahfi arif akbar-1012501571
Tugas4 [ku]-0316-kahfi arif akbar-1012501571Tugas4 [ku]-0316-kahfi arif akbar-1012501571
Tugas4 [ku]-0316-kahfi arif akbar-1012501571
 

More from GITS Indonesia

GITS Webinar: How to Build UI/UX Portfolio that Stand Out
GITS Webinar: How to Build UI/UX Portfolio that Stand Out GITS Webinar: How to Build UI/UX Portfolio that Stand Out
GITS Webinar: How to Build UI/UX Portfolio that Stand Out
GITS Indonesia
 
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
GITS Indonesia
 
Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...
Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...
Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...
GITS Indonesia
 
GITS Class #21 How to Build Your Dream Team to Achieve the Target
GITS Class #21 How to Build Your Dream Team to Achieve the TargetGITS Class #21 How to Build Your Dream Team to Achieve the Target
GITS Class #21 How to Build Your Dream Team to Achieve the Target
GITS Indonesia
 
GITS Class #20: Building A Fast and Responsive UI in React Native
GITS Class #20: Building A Fast and Responsive UI in React NativeGITS Class #20: Building A Fast and Responsive UI in React Native
GITS Class #20: Building A Fast and Responsive UI in React Native
GITS Indonesia
 
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Class #19: Build Large Scale Vue.js Apps with VuexGITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Indonesia
 
GITS Class #17: Coding Multiple Apps with Flutter
GITS Class #17: Coding Multiple Apps with FlutterGITS Class #17: Coding Multiple Apps with Flutter
GITS Class #17: Coding Multiple Apps with Flutter
GITS Indonesia
 
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Indonesia
 
GITS Class #12: iOS & Android Component Principles bersama Ajie Arga dan Radh...
GITS Class #12: iOS & Android Component Principles bersama Ajie Arga dan Radh...GITS Class #12: iOS & Android Component Principles bersama Ajie Arga dan Radh...
GITS Class #12: iOS & Android Component Principles bersama Ajie Arga dan Radh...
GITS Indonesia
 
GITS Class #11: Android Architecture Component bersama Derayan Bima (Android ...
GITS Class #11: Android Architecture Component bersama Derayan Bima (Android ...GITS Class #11: Android Architecture Component bersama Derayan Bima (Android ...
GITS Class #11: Android Architecture Component bersama Derayan Bima (Android ...
GITS Indonesia
 

More from GITS Indonesia (10)

GITS Webinar: How to Build UI/UX Portfolio that Stand Out
GITS Webinar: How to Build UI/UX Portfolio that Stand Out GITS Webinar: How to Build UI/UX Portfolio that Stand Out
GITS Webinar: How to Build UI/UX Portfolio that Stand Out
 
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
 
Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...
Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...
Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...
 
GITS Class #21 How to Build Your Dream Team to Achieve the Target
GITS Class #21 How to Build Your Dream Team to Achieve the TargetGITS Class #21 How to Build Your Dream Team to Achieve the Target
GITS Class #21 How to Build Your Dream Team to Achieve the Target
 
GITS Class #20: Building A Fast and Responsive UI in React Native
GITS Class #20: Building A Fast and Responsive UI in React NativeGITS Class #20: Building A Fast and Responsive UI in React Native
GITS Class #20: Building A Fast and Responsive UI in React Native
 
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Class #19: Build Large Scale Vue.js Apps with VuexGITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
 
GITS Class #17: Coding Multiple Apps with Flutter
GITS Class #17: Coding Multiple Apps with FlutterGITS Class #17: Coding Multiple Apps with Flutter
GITS Class #17: Coding Multiple Apps with Flutter
 
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
 
GITS Class #12: iOS & Android Component Principles bersama Ajie Arga dan Radh...
GITS Class #12: iOS & Android Component Principles bersama Ajie Arga dan Radh...GITS Class #12: iOS & Android Component Principles bersama Ajie Arga dan Radh...
GITS Class #12: iOS & Android Component Principles bersama Ajie Arga dan Radh...
 
GITS Class #11: Android Architecture Component bersama Derayan Bima (Android ...
GITS Class #11: Android Architecture Component bersama Derayan Bima (Android ...GITS Class #11: Android Architecture Component bersama Derayan Bima (Android ...
GITS Class #11: Android Architecture Component bersama Derayan Bima (Android ...
 

GITS Webinar: Implementasi REST API di iOS Menggunakan Alamofire dan SwiftyJSON

  • 1. Implementasi REST API di iOS menggunakan Alamofire dan SwiftyJSON
  • 2. Pembicara Zamaludin Abdulah iOS Dev. & Tech Lead GITS Indonesia Moderator M. Arif Rahman iOS Dev. & Content Creator GITS Indonesia
  • 4.
  • 6. Apa itu Alamofire? Alamofire merupakan library eksternal untuk melakukan transaksi dan koneksi data ke server di dalam aplikasi iOS/MacOS. Library ini dibangun dalam sistem pemuatan URL dari Apple yang disediakan oleh foundation framework. Alamofire lebih mudah digunakan dan menyediakan berbagai fungsionalitas yang diperlukan untuk pengembangan aplikasi menggunakan jaringan HTTP.
  • 7. Alamofire VS URLSession Kenapa membutukan alamofire kalau sudah ada fungsi bawaan Apple bernama URLSession
  • 9. ● Lebih elegan ● Lebih mudah dimengerti dan digunakan ● Baris Coding lebih singkat ● Development lebih cepat Pros and Cons Alamofire ● Tidak adaptif terhadap perkembangan bahasa pemrograman (Hal umum) ● Sering terjadi perubahan dimasa depan Pros : Cons :
  • 10. Alamofire ● 219 contributors ● 30K+ stars ● 42+ million (!!) downloads according to CocoaPods stats and 600K+ apps which are using it
  • 11. ● Lebih adaptif dengan bahasa pemrograman swift karena URLSession adalah default dari Apple ● Tidak ketergantungan dengan library Pros and Cons URLSession ● Melalui proses yang lebih panjang ● Memperlambat proses development ● Lebih sulit dipahami dan digunakan Pros : Cons :
  • 12. SwiftyJSON SwiftyJSON adalah library yang membantu membaca dan memproses data JSON dari API / Server. Jadi mengapa menggunakan SwiftyJSON? Swift sangat ketat mengenai tipe data dan harus dinyatakan secara eksplisit sehingga diperlukan SwiftyJSON untuk mempermudah mengelola data.
  • 13. SwiftyJSON VS JSONSerialization let json = JSON(data: dataFromNetworking) if let userName = json[0]["user"]["name"].string { //Now you got your value } if let statusesArray = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [[String: Any]], let user = statusesArray[0]["user"] as? [String: Any], let username = user["name"] as? String { // Finally we got the username }
  • 14. ● Lebih mudah ketika berhadapan dengan pengolahan data JSON ● Lebih mudah dimengerti dan digunakan ● Baris Coding lebih singkat ● Development lebih cepat Pros and Cons SwiftyJSON ● Tidak adaptif terhadap perkembangan bahasa pemrograman (Hal umum) ● Sering terjadi perubahan dimasa depan Pros : Cons :
  • 16. Tools yang dibutuhkan ● Xcode ● Cocoapod ● Terminal
  • 17. Generate JSON ke Model Swift Menggunakan JSONCafe.com
  • 18. Get Data List Movie