Swift 5 Brand New Result Type: Write Cleaner API code

preview_player
Показать описание
Great to see small little details still being added to the Swift 5 programming language such as the brand new Swift 5 Result Type. It's super useful but takes a little while to get used to how to set up the syntax correctly. This lesson will shed some light on how the code is written. Enjoy.

AppStore JSON APIs

Tinder Firestore Swipe and Match

Twitter Slide Out Menu Course

Podcasts Course

Intermediate Training Core Data

Instagram Firebase Course

Facebook Group

Completed Source Code

Hackintosh Build
Рекомендации по теме
Комментарии
Автор

Hi Brian. This is now introduced in SDK but this concept was already present in SwiftyJSON and Moya from a very long time. Also we can do it in 4.2 too

rajanmaheshwari
Автор

This video is by far the most mind clearing tutorial on Swift Result type. good job Brian.

LohenYumnam
Автор

This is a nice touch! By the way, just go and purchase all of Brian's courses and thank me later! Wish I had Brian to guide me when I was starting Swift development. But its never too late!

christostsangaris
Автор

I did not know abouzt this feature, but it will make my callbacks a lot easier and more readable - thank you!

saschasimon
Автор

It is just fun to watch your videos . It will be a few months before I can/would use this.

Ipadstands
Автор

Hi Brian., this is very good info .I have a problem to support iPad Pro(12.9 inch) screen. I added different font for iPhone and iPad. its working properly in other devices but in iPad Pro(12.9 inch) screen the text is too small and unable to read. need your help on this

subratglamindia
Автор

Very nice, I’ll implement this tomorrow since I’m refactoring some network code. Thanks Brian

krutomjer
Автор

Hey Brian!, what a nice tutorial. Indeed a practical example clarifies the concept very clearly.
Thanks for the video and keep Up!

awais.fayyaz
Автор

We can make a generic typealias Completion<T> = (Result<T, Error>) -> ()
and later we can simply use completion: @escaping Completion<T>
if we want to make only one function for decoding and api response

Zainanjum
Автор

Even though i switched to Web development, still following Brian for the vids

dany
Автор

It's very useful video!!!
I was confused about how to use "Associate Value" before
Now It's all clear
thank you so much Brian

t
Автор

thanks man, it makes my alamofire implementation more cleaner

badakml
Автор

What if we have category key with course name inside each array dict object under array and want to display list of objects based on category using segment selection in single tableview controller ? How can we achieve this ?

ProductsHub
Автор

nice video Brian. I got this working to fetch data & update my storyboard labels during viewDidLoad. My question is this... my URL string is 'http...(myhost)...?channel=' and I append the channel# when I send it. My API returns different data sets (same struc) for each channel, so after viewDidLoad channel=1, I would like to re-hit the API with channel 2 after 5secs, then channel 3, etc. How do I do this? I tried looping in viewDidLoad but it only updated my labels the last hit. Thanks :)

BLT-Tech
Автор

Hi Brain! Nice tutorial!
As for me, I prefer to make an API with separate success and failure closures. Is there something that I may lost with it?

ГеннадийОлейник-чв
Автор

My only problem with the Result approach, which Alamofire uses, is when I want data and an error.

For example, Instagram’s API sets the http status code AND returns JSON. I still want that JSON.

TheMcGloneCode
Автор

This is funny - I’ve been doing this since Swift 2 with generics, I’ve just been building the Result type myself.

Nightsd
Автор

Hi nice tutorial..can you please made tutorial on clean architecture with API request example?

hiteshrasal
Автор

Hey Brian, Thanks for this tutorial. I have a question for you.

I am curious if you have any information on handling the "response" var from the URL session completion. I assume response is the http error, like 200s for success, 400s for client error, etc. Is there much use to handling this response? I am currently building a simple backend with flask and I can return a json and a response code back with each route if I want. Are http responses necessary for mobile development?

peterirving
Автор

I use strict rules for using MVVM, this will break that. Or not?

MultiSimransingh