SlideShare uma empresa Scribd logo
1 de 62
LET'S MAKE YOUR DATA LOOK SEXY!
sunshinejr
thesunshinejr
WHAT IS AN APP?
BEAR
''APPS ARE JUST PRETTY
PICTURES OF JSON''
(ORTA THEROX)
DATA
7b22777764635f73657373696f6e73223a205ba7b226964223a
203432302c20226465736372697074696f6e223a2022496e7472
6f647563696e67204d61727a6970616e2e227d2c207b22696422
3a203432312c20226465736372697074696f6e223a2022576879
206469642077652064656369646520746f2062757920526561637
4204e617469766520616e642063616c6c206974204d61727a6970
616e202d2074686520627573696e657373207065727370656374
6976652e227d2c207b226964223a203432322c20226465736372
697074696f6e223a2022576861742773206e657720696e20456c
JSON
{"wwdc_sessions": [
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."},
{"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}
]}
PRETTY PRINTED
{
"wwdc_sessions": [
{
"id": 420,
"description": "Introducing Marzipan."
},
{
"id": 421,
"description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."
},
{
"id": 422,
"description": "What's new in Electron."
}
]
}
''PRETTY PRINTED JSON IS NOT A
PRETTY PICTURE OF JSON''
(ME)
AT LEAST IT'S NOT PRETTY FOR USERS
!
WHAT DEVELOPERS SAY ABOUT JSON:
WHAT DEVELOPERS SAY ABOUT JSON:
> JSON is awesome boring
WHAT DEVELOPERS SAY ABOUT JSON:
> JSON is awesome boring
> JSON is increcidbly fast slow as FK
WHAT DEVELOPERS SAY ABOUT JSON:
> JSON is awesome boring
> JSON is increcidbly fast slow as FK
> JSON is a good friend (???)
JSON IS A CHALLENGE!
If you don't love me at my
if let jsonResponse = data as? NSDictionary {
if let feed = jsonResponse["feed"] as? NSDictionary {
if let entry = feed["entry"] as? NSArray {
if let firstEntry = entry[0] as? NSDictionary {
if let name = firstEntry["name"] as? NSDictionary {
if let label = name["label"] as? NSString {
println("label: (label)")
}
}
}
}
}
}
Then you don't deserve me at my
let decoder = JSONDecoder()
let product = try decoder.decode(Product.self, from: data)
https://twitter.com/harlanhaskins/status/982249952154824704
(140 PAGES) BOOK ABOUT CODABLE
PERFORMANCE OF JSON DECODING
https://github.com/bwhiteley/JSONShootout
''JSON PARSERS'' ???
WE SHOULD CARE MORE ABOUT OUR DATA!
IS YOUR JSON PAYLOAD FROM THE API TOO BIG?
TRY TO CHANGE IT!
TREAT YOUR DATA LIKE A PRINCESS!!
UNDERSTAND HER DOMAIN!
ASK QUESTIONS!
> How do you split the works if you are not working
alone?
> How do you split the works if you are not working
alone?
> When do you migrate dependencies?
> How do you split the works if you are not working
alone?
> When do you migrate dependencies?
> What if one dependency does not work in newer
version?
> How do you split the works if you are not working
alone?
> When do you migrate dependencies?
> What if one dependency does not work in newer
version?
> What if you are 2 major versions behind?
> How do you split the works if you are not working
alone?
> When do you migrate dependencies?
> What if one dependency does not work in newer
version?
> What if you are 2 major versions behind?
> Do you use migrator?
> How do you split the works if you are not working
alone?
> When do you migrate dependencies?
> What if one dependency does not work in newer
version?
> What if you are 2 major versions behind?
> Do you use migrator?
> How do you test your app after the migration?
> How do you split the works if you are not working
alone?
> When do you migrate dependencies?
> What if one dependency does not work in newer
version?
> What if you are 2 major versions behind?
> Do you use migrator?
> How do you test your app after the migration?
> Do you do refactor while migrating the codebase?
HANDLE ALL THE STATES SHE MIGHT BE IN!
func viewDidLoad(animated: Bool) {
super.viewDidLoad(animated: animated)
loadData()
}
func loadData() {
api.fetchData { [weak self] data in
self?.data = data
self?.tableView.reloadData()
}
}
func viewDidLoad(animated: Bool) {
super.viewDidLoad(animated: animated)
loadData()
}
func loadData() {
tableView.isHidden = true
loadingView.isHidden = false
api.fetchData { [weak self] data in
self?.data = data
self?.loadingView.isHidden = true
self?.tableView.isHidden = false
self?.tableView.reloadData()
}
}
func viewDidLoad(animated: Bool) {
super.viewDidLoad(animated: animated)
loadData()
}
func loadData() {
tableView.isHidden = true
loadingView.isHidden = false
api.fetchData { [weak self] data, error in
if let error = error {
let alertController = UIAlertController(...)
self?.present(alertController, animated: true, completion: nil)
} else {
self?.data = data
self?.loadingView.isHidden = true
self?.tableView.isHidden = false
self?.tableView.reloadData()
}
}
}
INTRODUCE EXPLICIT STATE!
enum Layout {
case empty
case loading
case content
}
private func updateLayout(to: Layout) {
switch to {
case .empty:
contentView.alpha = 0.0
loadingView.alpha = 0.0
case .loading:
contentView.alpha = 0.0
loadingView.alpha = 1.0
case .content:
contentView.alpha = 1.0
loadingView.alpha = 0.0
}
}
LET HER KNOW YOU CARE ABOUT HER
LET HER KNOW YOU CARE ABOUT HER
EVEN WHEN SHE'S OFFLINE
> caching responses & policies
var request = URLRequest(url: url)
request.cachePolicy = .reloadIgnoringLocalCacheData
> recording & using stubbed responses
(OHHTTPStubs/Moya)
DON'T PASS HER TO THE WRONG GUY!
> Intermediate objects like View Model or Redenerable
> Intermediate objects like View Model or Redenerable
> Think about who is responsible for the data
HANDLE HER ERRORS PROPERLY!
provider.request(GitHub.repos(repo)) { (result) in
if case .success(let response) = result {
do {
let repos = try response.map(to: [Repository].self)
print(repos)
} catch let error {
print("There was something wrong with the request! Error: (error)")
}
}
}
???
WE CAN DO
BETTER!
SORTED BY EFFORT:
SORTED BY EFFORT:
1. Alert
SORTED BY EFFORT:
1. Alert
2. Smooth UI component that fits the screen
SORTED BY EFFORT:
1. Alert
2. Smooth UI component that fits the screen
3. Silent retries & cache fetching
SORTED BY EFFORT:
1. Alert
2. Smooth UI component that fits the screen
3. Silent retries & cache fetching
4. 2 & 3 at once
AND THE LAST BUT NOT LEAST...
THINK ABOUT HER ALL THE TIME
THANKS SO MUCH!
ANY QUESTIONS?
sunshinejr
thesunshinejr

Mais conteúdo relacionado

Último

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Último (20)

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Mobile Fest 2018. Łukasz Mróz. Let’s make your DATA sexy

  • 1. LET'S MAKE YOUR DATA LOOK SEXY! sunshinejr thesunshinejr
  • 2. WHAT IS AN APP?
  • 4. ''APPS ARE JUST PRETTY PICTURES OF JSON'' (ORTA THEROX)
  • 6. JSON {"wwdc_sessions": [ {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."}, {"id": 420, "description": "Introducing Marzipan."}, {"id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective."}, {"id": 422, "description": "What's new in Electron."} ]}
  • 7. PRETTY PRINTED { "wwdc_sessions": [ { "id": 420, "description": "Introducing Marzipan." }, { "id": 421, "description": "Why did we decide to buy React Native and call it Marzipan - the business perspective." }, { "id": 422, "description": "What's new in Electron." } ] }
  • 8.
  • 9. ''PRETTY PRINTED JSON IS NOT A PRETTY PICTURE OF JSON'' (ME)
  • 10. AT LEAST IT'S NOT PRETTY FOR USERS !
  • 11. WHAT DEVELOPERS SAY ABOUT JSON:
  • 12. WHAT DEVELOPERS SAY ABOUT JSON: > JSON is awesome boring
  • 13. WHAT DEVELOPERS SAY ABOUT JSON: > JSON is awesome boring > JSON is increcidbly fast slow as FK
  • 14. WHAT DEVELOPERS SAY ABOUT JSON: > JSON is awesome boring > JSON is increcidbly fast slow as FK > JSON is a good friend (???)
  • 15. JSON IS A CHALLENGE!
  • 16. If you don't love me at my if let jsonResponse = data as? NSDictionary { if let feed = jsonResponse["feed"] as? NSDictionary { if let entry = feed["entry"] as? NSArray { if let firstEntry = entry[0] as? NSDictionary { if let name = firstEntry["name"] as? NSDictionary { if let label = name["label"] as? NSString { println("label: (label)") } } } } } } Then you don't deserve me at my let decoder = JSONDecoder() let product = try decoder.decode(Product.self, from: data) https://twitter.com/harlanhaskins/status/982249952154824704
  • 17. (140 PAGES) BOOK ABOUT CODABLE
  • 18. PERFORMANCE OF JSON DECODING https://github.com/bwhiteley/JSONShootout
  • 20. WE SHOULD CARE MORE ABOUT OUR DATA!
  • 21. IS YOUR JSON PAYLOAD FROM THE API TOO BIG?
  • 23. TREAT YOUR DATA LIKE A PRINCESS!!
  • 25.
  • 26.
  • 28.
  • 29. > How do you split the works if you are not working alone?
  • 30. > How do you split the works if you are not working alone? > When do you migrate dependencies?
  • 31. > How do you split the works if you are not working alone? > When do you migrate dependencies? > What if one dependency does not work in newer version?
  • 32. > How do you split the works if you are not working alone? > When do you migrate dependencies? > What if one dependency does not work in newer version? > What if you are 2 major versions behind?
  • 33. > How do you split the works if you are not working alone? > When do you migrate dependencies? > What if one dependency does not work in newer version? > What if you are 2 major versions behind? > Do you use migrator?
  • 34. > How do you split the works if you are not working alone? > When do you migrate dependencies? > What if one dependency does not work in newer version? > What if you are 2 major versions behind? > Do you use migrator? > How do you test your app after the migration?
  • 35. > How do you split the works if you are not working alone? > When do you migrate dependencies? > What if one dependency does not work in newer version? > What if you are 2 major versions behind? > Do you use migrator? > How do you test your app after the migration? > Do you do refactor while migrating the codebase?
  • 36. HANDLE ALL THE STATES SHE MIGHT BE IN!
  • 37.
  • 38. func viewDidLoad(animated: Bool) { super.viewDidLoad(animated: animated) loadData() } func loadData() { api.fetchData { [weak self] data in self?.data = data self?.tableView.reloadData() } }
  • 39.
  • 40. func viewDidLoad(animated: Bool) { super.viewDidLoad(animated: animated) loadData() } func loadData() { tableView.isHidden = true loadingView.isHidden = false api.fetchData { [weak self] data in self?.data = data self?.loadingView.isHidden = true self?.tableView.isHidden = false self?.tableView.reloadData() } }
  • 41. func viewDidLoad(animated: Bool) { super.viewDidLoad(animated: animated) loadData() } func loadData() { tableView.isHidden = true loadingView.isHidden = false api.fetchData { [weak self] data, error in if let error = error { let alertController = UIAlertController(...) self?.present(alertController, animated: true, completion: nil) } else { self?.data = data self?.loadingView.isHidden = true self?.tableView.isHidden = false self?.tableView.reloadData() } } }
  • 43. enum Layout { case empty case loading case content } private func updateLayout(to: Layout) { switch to { case .empty: contentView.alpha = 0.0 loadingView.alpha = 0.0 case .loading: contentView.alpha = 0.0 loadingView.alpha = 1.0 case .content: contentView.alpha = 1.0 loadingView.alpha = 0.0 } }
  • 44. LET HER KNOW YOU CARE ABOUT HER
  • 45. LET HER KNOW YOU CARE ABOUT HER EVEN WHEN SHE'S OFFLINE
  • 46. > caching responses & policies var request = URLRequest(url: url) request.cachePolicy = .reloadIgnoringLocalCacheData > recording & using stubbed responses (OHHTTPStubs/Moya)
  • 47. DON'T PASS HER TO THE WRONG GUY!
  • 48.
  • 49. > Intermediate objects like View Model or Redenerable
  • 50. > Intermediate objects like View Model or Redenerable > Think about who is responsible for the data
  • 51. HANDLE HER ERRORS PROPERLY!
  • 52. provider.request(GitHub.repos(repo)) { (result) in if case .success(let response) = result { do { let repos = try response.map(to: [Repository].self) print(repos) } catch let error { print("There was something wrong with the request! Error: (error)") } } }
  • 53. ???
  • 57. SORTED BY EFFORT: 1. Alert 2. Smooth UI component that fits the screen
  • 58. SORTED BY EFFORT: 1. Alert 2. Smooth UI component that fits the screen 3. Silent retries & cache fetching
  • 59. SORTED BY EFFORT: 1. Alert 2. Smooth UI component that fits the screen 3. Silent retries & cache fetching 4. 2 & 3 at once
  • 60. AND THE LAST BUT NOT LEAST...
  • 61. THINK ABOUT HER ALL THE TIME
  • 62. THANKS SO MUCH! ANY QUESTIONS? sunshinejr thesunshinejr