Sunday, 14 April 2024

Swift Databases: Uploading Photos to Parse in Swift 2! (The Concept)

 


This time we're gonna be going over well uploading images to parse now I haven't really released a video in quite some time because I've been preparing for this in another video that are gonna see right after this one and so now to this video I'm going to be teaching you exactly how you can upload your own photos and images to parse or Rell really any file to parse i parse database really and so this is really useful for stuff like chatting apps and i will be creating another chatting app video in which i will tell you how to inc to integrate this for example you could upload people's profile pictures and you could allow people to put attachments in their messages etc etc and if adding apps get more and more complicated just like that and so i will be teaching you how to do that in another part of this video and the chatting out video but for now i'm just going to be showing you a very bare-bones app that uploads an image to parse from the web downloads again and shows it in an image view so let's get started and now let me just explain the logic behind this app then we'll get over to the Mac part saw in which I will actually show you the code and how this works okay so let's get started first of all let's see so basically what's gonna happen is let's say we have the internet over here or someone's website in specific okay and it has all these PHP files as J s files makes ml right however it also has a PNG file okay yeah in our case it's actually jpg but let's just pretend it's a PNG file what's gonna happen is we're going to find a URL for this PNG payal file okay and let's just pretend our app is over here over here and this is our up okay so now what's gonna happen is our app will take the URL okay so now it's going to take our URL it's going to convert this into NS data which I'm sure you've heard of if you've seen any of my other Swift databases tutorials okay so we're going to take the contents of this URL and we're going to put it into an estate out variable which will be put into well I have never ever covered this class before but it's a parse class and it's called PDF file okay so now essentially this class will allow us to store the NS data as a PF file and then we'll be uploading this to parse and so let's just say our parks database is over here this is our back end let's just say this database and this is labeled as parse okay now we're gonna take this PF file along with some PF objects and then we're going to send these over to our parse database or in more specific our parse class and so now what we're gonna do is since we've uploaded the image we actually have to download it in test if it works and so it's gonna happen is we're going to wait for a user to click the screen so we're just going to present pretend the user clicked over here okay if the user clicked over here then what they can really click anywhere but let's just pretend they clicked here what will happen is the app will grab data from parse into the app and then we'll extract specifically the PF file that we had uploaded convert this back into NS data and then convert this to a UI image which we then put into an image view more specifically a UI image view and so this is the essentially workflow of our app we we have a website in which we have an image we take its URL we take its contents convert to an NS data we take the sanest data put it into an PF file and then repaired along with a PF object to name it and then we put it onto parse then we download it from parts back onto our app then our map takes the PF file that we uploaded to parse it extracts it from the data that we grab from it it's going to convert that to NS data back and it's going to convert that into a UI image and then we're going to put this in a UI image view and that was the simple explanation of how this app works and so now and one more thing there's very limited to really no resource that I found online for this I mean there were a few but there were really old most of them were in objective-c and so they were quite hard to transfer over to switch but now I went to be making that much easier for everyone by showing you how to do this in Swift so let's get over to the Mac parts where I will be showing you the code and an implementation of this app so let's get to it


No comments:

Post a Comment

Connect broadband