For anyone who’s done react native development this will actually look pretty straightforward. Minus the combine stuff depending on if you’ve done Rx stuff. Pretty cool! Thanks for putting this out there even though it’s clear that you’re learning as well. We need more of this!
FYI, Never is Swift's bottom type, a type that doesn't have any instance (you can't create a Never). This allows us to encode in the type system that the subject can't fail. That's what you want for UI so that's why is always used in there ;)
You shouldn’t need to call dispatch. You can call onReceive. Also you should initialize the network manager in scene delegate and make it into an environmental object.
I know this is an older video and they deprecated Bindable object but I was finally able to get my stuff working following this with Observable Object.
Nice tutorial as always! Quick suggestion. Instead of fetching in the init() of NetworkManager you can use, on the NavigationList or a Group surrounding the NavigationList , at the end of the brackets Group { ...}.onAppear(perform: networkManager.fetch)
You definitely don't want to perform a network refetch if the view appears a second time, for example when a controller is popped and shows this view again.
Hey dude. Question. Once the app loses internet what happens ? Any way you can create a tutorial on how to save the data locally so that it’s not always needing internet ?
I'm trying to do a vertical scroll that makes one of the images slightly bigger when scroll stops. How do you set the feature image to appear bigger than the rest when scroll stops. similar to this but not exactly
@State @objectbinding being used for the same requirement of observing the state of bindable object. I think we should use only @objectbinding in both the cases as we are using the variables of external types ViewModel and ImageView.
I need help ! With that Tuto, I get data after UI. For example : List(networkManager.movies.results, id: \.id) networkManager.movies.results.count = 0. I use themoviedb API. Thanks in advance !
. I'm trying to build an app that searches through the web (Using web scraping) and returns the specified data instantly (data can be updated on the website and I want it to be updated in my app as well), can that be done with JSON?
The best practice is not to use CoreData. ;) haha only joking. How would it be any different to using it with UIKit/ appkit? Actually that said if you look at some of the patterns used with realm and RxSwift it may give you some hints. That or something like flux.
got error in line 50 "Cannot infer key path type from context; consider explicitly specifying a root type" got error in line 52 "Cannot convert value of type 'Int' to expected argument type 'Course'"
Hi Brain I'm found that to load with Kingfisher/SwiftUI pod KFImage(URL(string: course.imageUrl)!, options: [.transition(.fade(0.5))]) .frame(height: 200) .resizable()
Thank you for the video. I reused the ImageViewWidget in my application and wrap it with NavigationButton. Somehow the image stop appearing. Thank for any tips
As I have pointed out below If you look at the View documentation there is a list of view lifecycle events under the Handling view events section developer.apple.com/documentation/swiftui/view So handling the onAppear event would be something like this Text("Test Text View") .onAppear(perform: { print("Wooter") })
As far as I understood correctly, @State is for binding a local variable, while @ObjectBinding is for binding an 'external' model object. Check out WWDC 2019 Session 226 for more information (especially around 31:00)
We all are one.. A very humble and polite request to iOS Developers of every country, stop selling your apps at least price.We are developers and each app that we make needs efforts ,time and patience. We think of an idea...design UI and write code for it.After everything, we go through the stress of apple review where there are chances of approval and rejection both.On approval ,we get money and on rejection we get nothing.We are doing hard work and it needs to be appreciated, we can't compromise for less. A client offered 250$ for an app, later the same client offered 150$ and now asking to sell apps at 70-80$ .....This is all due to few developers have started selling apps at minimal cost like 70-80$.We need to show a little patience ,if we will adjust for 70-80$ ,then soon there will be a day when we all will loose our identity and will be suppose to sell app at 10-20$ also. PLEASE STOP COMPROMISING AT LOW PRICE AND LET'S GROW TOGETHER,"WE ARE IOS DEVELOPERS"!!!
Hello, how can i pass userdata (user id) from an EnvironmentObject to the Networkmanager class? I tried to use it in the class: class Networkmanager: ObservableObject { @EnvironmentObject var userdata: userData and in the Url i can pass the data: guard let url = URL(string: "api.letsbuildthatapp.com/jsondecodable/courses/index.php?userid=\(userdata.userId)") else { return } It does not throw an error in xcode but wenn i start the app i get the error: Fatal error: No ObservableObject of type userData found. How can i fix it?
Swift is a programming language. SwiftUI is a framework for creating the visual user interfaces you see in an iOS app. Currently we use the UIKit framework to make user interfaces in iOS, and the AppKit framework for MacOS user interfaces. SwiftUI is a brand new framework written entirely using Swift that can be used to create user interfaces across all Apple's operating systems from the Mac down to the Apple Watch. So yes, you will need to learn Swift to use SwiftUI.
@@metalsquid Small correction: parts of SwiftUI are written in C++. In fact, parts of SwiftUI actually predate the creation of Swift. SwiftUI has been in development for at least 7 years, maybe 10.
@@w0mblemania At WWDC they said that SwiftUI was "built from the ground up in Swift, for Swift". I took that to mean SwiftUI was written 100% in Swift. Thanks for pointing out that isn't the case. I should word it more accurately in future.
Not working on Xcode beta 5 Black screen occurs after loading. I've changed deprecated methods, but with no success Also i tried to create my project with the same code and updates for deprecated methods, but binding not working and after i receive data from JSON the @State variable not updating view((
There are, NO, -> such method of "infinite loading", literally. (No one has a device that can store infinity number of objects) Someone, comes up with an approach of fetching data, to make it sound, superior, hehe. And, a lot of other coders/programmers like the term. Because, it sounds good. hahaha. Dart, for example, if you fetch 1000 records, only 10 items were visible on the device. It will only fetch the view box's contents. (10 items) => even IF, there exist, infinity number records, one can do continue fetching, without running out of RAM. That was a very old idea. I do not know, how SwiftUI will implement this approach. I suspect, it is the same approach. So, as long as you do NOT store all records, and only those in the viewBox, at any time, THEN, it is LIKE infinity loading. Max Int64 Integer for Swift is: 9223372036854775807 Is that an infinity number?
You really don't. That would be very inefficient what you want to do is to update your view every time your data changes. So what you could do is set up an observable that is subscribed to by your view and to emit the changes to that observable stream. That way any changes propagate to anyone that cares about it. SwiftUI is reactive most of the time you don't need to hook into the view lifecycle like that. That said if you look at the View documentation there is a list of view lifecycle events under the Handling view events section developer.apple.com/documentation/swiftui/view So it would be something like this Text("Test Text View") .onAppear(perform: { print("Wooter") })
how to check downloaded json? if clauses! = nil { List {..} } Else { ........ } the body is a mess. nenache you can create for thousands of objects !!!
Hehe, ReactiveNative Facebook's Silly things (make Mr.S/Z a Billionaire); a lot of "billionaire wannabe"s were out there! But it is too late. Native only to those wannabe's home. Calling something NATIVE, which is NOT native, Is it funny? ......AD.....AD.....AD....AD......AD.......AD.......AD.......$$$$$$$$$
Apparently no one knows how to create a list with dynamic sections And delete rows functionality. Like a list of employees sectioned by departments and still can delete rows!! Can you?!
You should make a paid course for swiftUI at some point that goes more in depth on the framework. The way your videos are now I would love going through a class taught by you!
Maaaate wtf got to you setting the didSet. You clearly don’t know what you’re doing. Your passing self to a state object, this is a retain cycle? Never, means that there isn’t ever going to be a failure case in the network manager. Which clearly isn’t true. As it’s a network/JSON parser.... You’re also capturing self in your network completion........ Oh god, now he’s used a force unwrap on the JSON parser. I advise no one to follow this video...
if aJsonObject.Result != nil // SUPERIOR PROGRAMMER. (really not too much real world experiences) ObjC, that is more relevant. With managed framework, aka UWP, DART, and Swift, very little to worry about. One will know, when ever there is a leak. Hint: Instrument. Please DONOT scare newbie, with this phrase. hehe. Disclaimer: I am a silly old man.
I am sorry, but this guy is right, even though you are making fun of him in your other video. I respect your work and your videos are helpful, when you are experienced enough to see that your code is often quick & dirty . But please be aware that most of the people watching your video aren't experienced iOS devs or devs at all. You should be always a good role model and assume especially beginners are gonna take your code as it is, as someone who sells paid courses you should take more responsibility IMO.
Hi Mr@@CihanBoz , Sir, let me be clear, I AM NOT J from N, friend of MR.B. I have been, writing programs for 45+ year, never stopped. Yet, I am very impressed with Mr.B's ability to demonstrate the concept, in real time. If you were, like me, retired, wasting time watching a lot and a lot of YT tutorial and read literally many hundreds of GitHub projects, THEN, you will agree with me, Mr. B is one of the best. Unless, you yourself, were J from N. His competitor. Pls, do not take me, seriously. Human, the nature is lazy and sloppy. Men, Programmers more so.
If your doing tutorial videos you should be striving for best practices as people will just copy your code verbatim. It’s important to understand the concepts and not pickup bad habits.
Great video, but it's a bit outdated. I'd recommend watching this and using HackingWithSwift's "How to use @ObservedObject to manage state from external objects" page for a companion on how to use the current method. It's much simpler now!
For anyone who’s done react native development this will actually look pretty straightforward. Minus the combine stuff depending on if you’ve done Rx stuff. Pretty cool! Thanks for putting this out there even though it’s clear that you’re learning as well. We need more of this!
FYI, Never is Swift's bottom type, a type that doesn't have any instance (you can't create a Never). This allows us to encode in the type system that the subject can't fail. That's what you want for UI so that's why is always used in there ;)
Wow... I'm glad you went first on this!
You shouldn’t need to call dispatch. You can call onReceive. Also you should initialize the network manager in scene delegate and make it into an environmental object.
Please elaborate.
Do you have a code sample to explain this?
@@tapizquent You need to watch all the WWDC sessions on SwiftUI and Combine. They are required viewing at this point. Cheers.
I know this is an older video and they deprecated Bindable object but I was finally able to get my stuff working following this with Observable Object.
ohh man i literally struggled for days until i find this. Thanks so much :)
im loving this swiftUi framework
Always the best content!!! Love your videos mate! Tks!!!
Thank you for the insights, top quality channel 👌
On XCode beta 4
the variable didChange was renamed to willChange
Thank you for the video.
“Now I’m going to pray that the syntax highlighting comes back” 😂 yep sounds familiar
What if I want to fetch and render it into a text component, how should I do it?
DUDE I LOVE YOUR VIDEOS!
Nice tutorial as always!
Quick suggestion.
Instead of fetching in the init() of NetworkManager you can use, on the NavigationList or a Group surrounding the NavigationList , at the end of the brackets Group { ...}.onAppear(perform: networkManager.fetch)
You definitely don't want to perform a network refetch if the view appears a second time, for example when a controller is popped and shows this view again.
Thanks for the video! Will this be used to reduce the amount of server load?
🤟Reactive Programming 🤟
Yay it’s Rebeloper
Hey dude. Question. Once the app loses internet what happens ? Any way you can create a tutorial on how to save the data locally so that it’s not always needing internet ?
Worth noting - in the final release, Combine will mean you don’t have to add all that extra code!
Indeed I was waiting for the combine sdk to be released. Not sure how to work with publisher yet.
I'm trying to do a vertical scroll that makes one of the images slightly bigger when scroll stops. How do you set the feature image to appear bigger than the rest when scroll stops.
similar to this but not exactly
@State @objectbinding being used for the same requirement of observing the state of bindable object. I think we should use only @objectbinding in both the cases as we are using the variables of external types ViewModel and ImageView.
Hello in this case using method get, and how we can post data to api?
I need help ! With that Tuto, I get data after UI. For example : List(networkManager.movies.results, id: \.id) networkManager.movies.results.count = 0. I use themoviedb API. Thanks in advance !
Great job 👍
.
I'm trying to build an app that searches through the web (Using web scraping) and returns the specified data instantly (data can be updated on the website and I want it to be updated in my app as well), can that be done with JSON?
Can you please make a video showing how to make draw/make shapes on swiftUI manually
Question: do you like SwiftUI or is it just new framework that will be redundant in 5 years (per your earlier video)?
May you please talk about CoreData + SwiftUI best practices
The best practice is not to use CoreData. ;) haha only joking. How would it be any different to using it with UIKit/ appkit?
Actually that said if you look at some of the patterns used with realm and RxSwift it may give you some hints. That or something like flux.
*cough* Realm DB *cough*
My prayers has been answered!! Lol Thank you!
Lakad Matataaaag ... Normalin Normalin :3
Han Naung I don’t get what you’re saying but I’m excited too 😂
@@CuriosMindDIY 'My prayers are answered ' word is Dota2 game' chat weel . so, i thought you are the one of dota gamer 😁
Han Naung I used to play LoL tbh hahah
Nice Video. How can i Save those fetched JSON objects in a database like we done it in Core Data?
Best regards
Thanks again, Brian! I have my test app working perfectly with these steps. Could you possibly show how to pass this data into another view?
Would you use the same approach to parse XML/Atom? What would be the difference in code?
got error in line 50
"Cannot infer key path type from context; consider explicitly specifying a root type"
got error in line 52
"Cannot convert value of type 'Int' to expected argument type 'Course'"
Sweet!! Thank you Brian..!
Can you also make a video with Image Caching as well? It will be very helpful...
Thanks for the great tutorial 🙏🏻
Hi Brain
I'm found that to load with Kingfisher/SwiftUI pod
KFImage(URL(string: course.imageUrl)!, options: [.transition(.fade(0.5))])
.frame(height: 200)
.resizable()
Also, we can load data on the list instead of binding
.onAppear(perform: getCourses)
If you want to hit the network every time your list appears :)
Easy for you to say!
Love Your videos and wonder if you do this the same way for core data with binding ? Thanks for all your tutorials so far
hello please i have a question
Thank you for the video.
I reused the ImageViewWidget in my application and wrap it with NavigationButton. Somehow the image stop appearing.
Thank for any tips
Hail the AsyncImage
Hey does anyone know how I could for example get a body of JSON where - lets say - the 'name' is something specific
How to do this only with "optionals" from API ? ( let author: String? )
Excellent job master =)
Could you please make a tutorial explaining how to make the Face ID circles animation? I haven’t be able to find one.... thank you
What is the name of the background tune at the beginning of the video?
Question: do the views have lifecycle methods?
As I have pointed out below
If you look at the View documentation there is a list of view lifecycle events under the Handling view events section
developer.apple.com/documentation/swiftui/view
So handling the onAppear event would be something like this
Text("Test Text View")
.onAppear(perform: {
print("Wooter")
})
Thanks for this!!!
what is the diff between @state and ObjectBinding? They looks the same in this example.
As far as I understood correctly, @State is for binding a local variable, while @ObjectBinding is for binding an 'external' model object. Check out WWDC 2019 Session 226 for more information (especially around 31:00)
You're awesome man
We all are one..
A very humble and polite request to iOS Developers of every country, stop selling your apps at least price.We are developers and each app that we make needs efforts ,time and patience.
We think of an idea...design UI and write code for it.After everything, we go through the stress of apple review where there are chances of approval and rejection both.On approval ,we get money and on rejection we get nothing.We are doing hard work and it needs to be appreciated, we can't compromise for less.
A client offered 250$ for an app, later the same client offered 150$ and now asking to sell apps at 70-80$ .....This is all due to few developers have started selling apps at minimal cost like 70-80$.We need to show a little patience ,if we will adjust for 70-80$ ,then soon there will be a day when we all will loose our identity and will be suppose to sell app at 10-20$ also.
PLEASE STOP COMPROMISING AT LOW PRICE AND LET'S GROW TOGETHER,"WE ARE IOS DEVELOPERS"!!!
Hello, how can i pass userdata (user id) from an EnvironmentObject to the Networkmanager class? I tried to use it in the class:
class Networkmanager: ObservableObject {
@EnvironmentObject var userdata: userData
and in the Url i can pass the data:
guard let url = URL(string: "api.letsbuildthatapp.com/jsondecodable/courses/index.php?userid=\(userdata.userId)") else { return }
It does not throw an error in xcode but wenn i start the app i get the error:
Fatal error: No ObservableObject of type userData found.
How can i fix it?
it's like rxjs, or ReactiveX in general, web devs been using this for year on web apps.
Lots of people use it for lots of things, it doesn’t come from web
What's the difference between swift and swiftUI? Do we need to learn swift to use swiftUI?
SwiftUI is ridiculous never go around swiftui
Swift is a programming language. SwiftUI is a framework for creating the visual user interfaces you see in an iOS app. Currently we use the UIKit framework to make user interfaces in iOS, and the AppKit framework for MacOS user interfaces. SwiftUI is a brand new framework written entirely using Swift that can be used to create user interfaces across all Apple's operating systems from the Mac down to the Apple Watch. So yes, you will need to learn Swift to use SwiftUI.
@@metalsquid Small correction: parts of SwiftUI are written in C++. In fact, parts of SwiftUI actually predate the creation of Swift. SwiftUI has been in development for at least 7 years, maybe 10.
@@w0mblemania At WWDC they said that SwiftUI was "built from the ground up in Swift, for Swift". I took that to mean SwiftUI was written 100% in Swift. Thanks for pointing out that isn't the case. I should word it more accurately in future.
@@metalsquid np. Apple marketing is... marketing. Apple engineers on Twitter told a different story, is all. Cheers.
Thanks Dude.
Is there a way to view this tutorial not as a video? Would be nice to see the project files or something instead
Just look in the description for the project download.
@@LetsBuildThatApp Thanks, sorry it was a bit hard to find with all the other links in there.
Welcome to the world of spam marketing :)
Cool videos :D
Not working on Xcode beta 5
Black screen occurs after loading. I've changed deprecated methods, but with no success
Also i tried to create my project with the same code and updates for deprecated methods, but binding not working and after i receive data from JSON the @State variable not updating view((
Binding has changed dramatically.
@@LetsBuildThatApp Yes, let's wait for stable version))
Also Brian could you made a video about Viper pattern and rxSwift)
how to do infinite loading using this approach?
There are, NO, -> such method of "infinite loading", literally. (No one has a device that can store infinity number of objects)
Someone, comes up with an approach of fetching data, to make it sound, superior, hehe. And, a lot of other coders/programmers like the term. Because, it sounds good. hahaha.
Dart, for example, if you fetch 1000 records, only 10 items were visible on the device. It will only fetch the view box's contents. (10 items) => even IF, there exist, infinity number records, one can do continue fetching, without running out of RAM.
That was a very old idea.
I do not know, how SwiftUI will implement this approach. I suspect, it is the same approach.
So, as long as you do NOT store all records, and only those in the viewBox, at any time, THEN, it is LIKE infinity loading.
Max Int64 Integer for Swift is:
9223372036854775807
Is that an infinity number?
If i want to call my api , every time when View is did appear how i can do that , in UIKit
I use ViewDidAppear ... but what's the equivalent here ?!
You really don't. That would be very inefficient what you want to do is to update your view every time your data changes.
So what you could do is set up an observable that is subscribed to by your view and to emit the changes to that observable stream. That way any changes propagate to anyone that cares about it.
SwiftUI is reactive most of the time you don't need to hook into the view lifecycle like that. That said if you look at the View documentation there is a list of view lifecycle events under the Handling view events section
developer.apple.com/documentation/swiftui/view
So it would be something like this
Text("Test Text View")
.onAppear(perform: {
print("Wooter")
})
Correct, make use of the new Reactive style programming and all will be good.
Sorry .. but that fucking awesome 😍😍😍
The network manager reminds me of mobx.
Thanks :)
luv it
how to check downloaded json?
if clauses! = nil {
List {..}
} Else {
........
}
the body is a mess. nenache you can create for thousands of objects !!!
10:35 Please. It's a component. Please. Infact apple is calling it a component too. So no widgets please and thanks 😆
Thank you again for wonderful video. I hate to give you only 1 like (not 10 or 100 likes ) (yes)
how to load array ??
Post Parameter : ID -> 8
Json Response:
{ "success": "true"
"list":
[
{"nameCourse": "Swift",
"imageUrl": "....."}
{"nameCourse": "Kotlin",
"ImageUrl": "...."}
]
}
I really want to get used to this new swiftUI but I just can't :(
Because?
aaaand I'm sticking with regular swift and objective c, and yes even storyboards. I'll switch to react native before this lol
Hehe, ReactiveNative Facebook's Silly things (make Mr.S/Z a Billionaire); a lot of "billionaire wannabe"s were out there! But it is too late. Native only to those wannabe's home.
Calling something NATIVE, which is NOT native, Is it funny?
......AD.....AD.....AD....AD......AD.......AD.......AD.......$$$$$$$$$
18:20 -
Image(uiImage: (UIImage(data: imageLoader.data)) ?? UIImage(named: "Apple")!)
just in case...
add image in asset with name apple, but equals dont work, i test and dont wrks
game of thrones remembered 😕
.identified(by: \.name) Xcode 11 Beta 4 -> new Xcode 11 Beta 5 - ,id: \.name
For those following along at home:
gist.github.com/chriseidhof/2c3bcdfa5bfa0795b33bd17f1e88771d
Followed this tutorial, but did it with the new iOS 13 update. github.com/joemissamore/SwiftUIJSON
Anyone has an issue that the List empty and I check my debugging area the data load fine
me too, have you find a solution ?
Kevin Teixeira yes check out the image holder for me I forget to add the image in the assets folder
Beta 5 broke things for me- working github update is here github.com/antwerpenR/pokemonListFromJSON
Apparently no one knows how to create a list with dynamic sections And delete rows functionality. Like a list of employees sectioned by departments and still can delete rows!!
Can you?!
Wait for it to come out of beta before you blow a gasket :)
Lets Build That App interesting. Never thought it could be a bug. Just thought it’s too hard to implement!
Thanks a lot, life is good again 😁
This is looking like a nightmare.
Why?
Looks like Flutter. Don't hunt me down. I don't have a Mac I'm not rich.
outdated :(
Jeez, now trying to load an image. There’s a lot of, “I don’t know why I do this’
Why? Beta Xcode Beta MacOSX........ BETA?
You should make a paid course for swiftUI at some point that goes more in depth on the framework. The way your videos are now I would love going through a class taught by you!
BANG operator is called a force unwrap...
"Just a software developer and game enthusiast" will know, what is TRIVIAL. and tomato vs toMAto.
Maaaate wtf got to you setting the didSet. You clearly don’t know what you’re doing. Your passing self to a state object, this is a retain cycle? Never, means that there isn’t ever going to be a failure case in the network manager. Which clearly isn’t true. As it’s a network/JSON parser....
You’re also capturing self in your network completion........
Oh god, now he’s used a force unwrap on the JSON parser.
I advise no one to follow this video...
if aJsonObject.Result != nil // SUPERIOR PROGRAMMER. (really not too much real world experiences)
ObjC, that is more relevant. With managed framework, aka UWP, DART, and Swift, very little to worry about.
One will know, when ever there is a leak. Hint: Instrument.
Please DONOT scare newbie, with this phrase. hehe.
Disclaimer: I am a silly old man.
I am sorry, but this guy is right, even though you are making fun of him in your other video. I respect your work and
your videos are helpful, when you are experienced enough to see that your code is often quick & dirty . But please be aware that most of the people watching your video aren't experienced iOS devs or devs at all. You should be always a good role model and assume especially beginners are gonna take your code as it is, as someone who sells paid courses you should take more responsibility IMO.
Hi Mr@@CihanBoz , Sir, let me be clear, I AM NOT J from N, friend of MR.B.
I have been, writing programs for 45+ year, never stopped. Yet, I am very impressed with Mr.B's ability to demonstrate the concept, in real time. If you were, like me, retired, wasting time watching a lot and a lot of YT tutorial and read literally many hundreds of GitHub projects, THEN,
you will agree with me, Mr. B is one of the best. Unless, you yourself, were J from N. His competitor.
Pls, do not take me, seriously.
Human, the nature is lazy and sloppy. Men, Programmers more so.
Andy Wong just do if result = aJsonObj3ct.result {} then as it’s cleaner. Or use guard.
If your doing tutorial videos you should be striving for best practices as people will just copy your code verbatim. It’s important to understand the concepts and not pickup bad habits.
Great video, but it's a bit outdated. I'd recommend watching this and using HackingWithSwift's "How to use @ObservedObject to manage state from external objects" page for a companion on how to use the current method. It's much simpler now!