Gif in UIImageView in Swift 5 with Gifu (Xcode 10.2)

big load gif This is a topic that many people are looking for. star-trek-voyager.net is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, star-trek-voyager.net would like to introduce to you Gif in UIImageView in Swift 5 with Gifu (Xcode 10.2) . Following along are instructions in the video below:

“Kesmat el deeb nreviewer riaki poni. T i m obsessed with the question i ve ve collected 26000. Responses nto this question in eight different schools from the poorest schools los angeles to suburban schools in texas nto elite private schools abroad and after 24 years of teaching students. I m still perplexed by this question today.

I m going to teach you the lessons. I learned nfrom those thousands of students and learn what i found out from them nif. We just listen to students the thing about it is that during my time nof asking kids this question. I realized that we don t ask this question nfor.

A particular reason schools are afraid based on fear. They don t really nwant to know what kids think partially because they don t think nkids will take it serious i m going to share with you none of the most profound quotes answers to this question nthat i ve ever received a great teacher eats apples laughter now i know what you re thinking doesn t this prove my point when i first saw this ni dismissed it as silliness. But it appeared again and again. So i thought so one day.

I decided ni would start eating apples. I ate them in the morning at lunch nduring class in the hall kids began to give me apples. The d see me eating them nand say they would smile and i would smile back it wasn t until i understood nthat kids wanted to see me as somebody who is willing nto receive a gift from them that the apple was a symbol nfor our relationship there was goodness in that and trust but for a long time i wasn t listening nand. I hadn t understood this a great teacher is chill.

They have their own language. When they say what they really mean is n be calm in all situations ndo. N t get overwhelmed laughter. They have a way of speaking to us nabout.

What they really want to tell us. But we have to listen right i m the father of two grown kids they re out of school now and in college. But when they were at home nand. They were teenagers.

I had to learn a whole new language. When they would come home nfrom school. I might ask them which usually meant n. Nothing happened eventful.

I probably learned something nmaybe. I didn t but if they came home nand said if i asked them how their day was nand. They said what they were trying to tell me was n. And you should probably nask me more questions.

But don t expect me to answer laughter kids have their own language. Nthey have their own way of thinking. They want us to think like them and understand nwhat s inside of their head. They have so many ways nof thinking that things are great they want us to see ntheir world inside of them.

But they don t want us to act like them they want us to be calm nand protect them and keep them safe kids have a way of communicating and adults just haven t spent nthe time listening. But what if we did what if we really listen ndeeply to students one of the things i noticed after all the years nof collecting these responses is that there is patterns that emerge when i asked the question nof. What makes a good teacher great oftentimes. I heard n.

70. Percent of the time the quote nor the answer that followed was the reason. This is significant nis. They don t see this happening.

They don t see teachers nlearning in front of them they see them teaching..


But they wish they would learn nalong with them think about it principals hire teachers nto be content experts to have all of the knowledge nnot to be learners. But what if they did what if you showed up in the classroom nand. The teacher had something prepared said but i can t wait to learn with you or that they saw their teacher struggle through something nthey. Didn t actually know and then eventually discover the answer kids want to be inspired by this idea nthat learning is important.

But they don t see it in schools. A great teacher isn t a teacher when i saw this quote n. I actually was a little bit offended they re like what they were trying to tell me is a great teacher isn t in the classroom think about it think about a time that you have nsome enduring understanding a time when you learned something that you still remember nand you use to this day like throwing a baseball or riding a bike. I remember learning nto ride a bike from my mom when i was five years old she took off the training nwheels of my bike.

She got behind me and began to push and we ran and we ran until she finally let go nand. I began to ride a bike that s what i did nthat s how i learned to ride a bike i can still ride a bike to this day nfrom that moment but can you imagine if i tried to learn nto bike from my mom in a classroom. What it would look like copy this nbike riding 101. Laughter.

There s the pedals and the crank nand. There s a chain that turns the wheel. You have to have a significant force once the force has enough momentum nyou can keep your balance. That s how a bike works.

I want you to learn all the parts nbe able to label them and draw them. Then you re going to learn nand write a research paper about the history of bike riding laughter all the important elements nthe adventure. The development of bikes and at the end of that nyou re going to take a final examination. If you pass and get an a nyou can ride a bike laughter at five years old ni think i would ve said laughter.

This is exactly what we do to children we put them in a classroom. And tell them and kids know that it s not true that we don t really value nlearning. This way. So.

No wonder they re disruptive. Nor bored or disengaged kids want us to be teachers. Nthat aren t teachers. I want to tell you a story about yvette.

They really do they want us to know nthat their life in school is way more different nthan. The life outside of school. I just thought your job is to do school nmy job is to teach yvette was a tough student. She was feisty and she had nan infamous reputation.

She walked around nwith a jacket to prove it whenever she walked around nthe kids would follow. She would come in and sit nin. The front row and lean just so that she can have neye contact to intimidate me she would call me when she d get up to go to the bathroom nall. The girls would follow eventually i learnt from yvette nwhat.

She needed to learn and i thought i became npretty good at what i was doing i noticed one day she stopped nturning in her homework. She had become a great leader nin. The classroom. She turned in her homework nshe participated in class.

She actually was quite good so. When this happened ni was surprised so i went up to her and said n. She said tomorrow came and just a few sheets nof unfinished work were turned in i also went up to her and said n. She said because it s the quietest nplace in my house.

But this week..


The electricity nwas turned off and it s dark in there i had a candle. But it burned out and i m sorry she gazed down not her prideful self. I had missed the point i had not listened when she said n. I heard the words but i didn t listen great teachers notice nwhen.

There s a struggle. They don t make assumptions nabout. What kids can and cannot do they wait and watch nand. They rescue them when they re stuck good teachers.

Hear them nbut. They don t listen i ll never forget yvette nand. I m grateful because whenever i see nan answer of a student like that i remember her and i listen a great teacher. Sings.

This was the most perplexing answer ni think i ever received it happened every year for ten years. Nat. Least. One student would put this.

What are they talking about i can t sing so i started thinking n. It wasn t until danny turned it in nas. One of his responses. He was the class clown.

You know he was the one nthat when we took the class picture he put ear fingers behind your head. He would make faces nat me. During lectures so i would laugh everything was a joke to danny so when he turned in his responses and they were all serious nand actually really good. I was surprised when this nshowed up in the middle.

But i knew there was something to it ni just didn t know what so the next day ni put the agenda on the board listing all the activities of the day. Nthe expectations. And the homework and instead of aclet s nadd in here. 150 and the same goes for the height.

Let s build and run and see the image nview on the screen just so we there we go. It is really nice nokay and finally i want to add a ui button here so we may tap on it or that nindicates that we are going to download this image view this image and put it ninto the image view. So finally lazy var and i will just call this button of course nit is a download button. But hey this is a small project so it would be a ui nbutton let button equals ui button let s return this button okay and maybe let s nstylize it a little bit so button let s see background color equals and i will use let s see let s use this white nbackground color will be a white button.

Okay and let s add. Some corner radius to nour layer. So corner radius equals. Let s say seven and button.

So this corner radius takes a fact that said layers masks to bound nequals true that is that now it s time to add our buttons set title and the ntitle will be download image or rather yet let s just fetch image because we nare not really downloading. I don t want to give you interaction that we are ndownloading for the state of normal and let s add our button a target so add ntarget self action. Hash selector and button tapped that is really clever. Way.

Nof. Adding. A selector and the event will be touch up inside inside. There we go nand let s just copy this selector title.

And it will be an objective c..


File. Nprivate func. There we go and we are ready so with this button. So let s add nit to our view hierarchy.

So view dot add sub view and button. And we want to add nit below our image views. So button top to and constrainable. We will use nimage view and anchor will be now nil offset let s say to 24.

Okay that is it for this constraint and i want to set the buttons nleft anchor to the super view so left to super view there it is the first one nand. I will offset it to let s say. 12. And i will not use safe area at this time nsame goes for the right anchor.

So there we go right. And it will be minus 12 nand. Finally let s add a height for our button. So height and 50 is fairly enough none thing i want to add in here is the button font so we get so title label dot font ui font.

I will use a bold system type font and nit is 60. So let s build and run. And see what we get here awesome nwe need to add this constraint. It to the bottom of our view our image views nso top to bottom of constrainable image view offset.

24. There we go nlet s build and run and hopefully now the layout will be perfect and we can nmove on to adding our gif. Okay that is a great okay. Oh.

We still need to set the ntitle labels colors. So let s go here and button set title color. And i will use nthis black. One that we have here let s delete it and ndrag and drop it again there we go and for the state.

That is normal nfinal time let s build and run here we go fetch image. There we have everything that we nneed for now okay now it s time to add our logic. So let s see here nlet s import gifu first so import gifu there we go and now we can basically add our gif nto our image view. While our loading a gif.

So what we need here is the loading ngif doesn t need to be a ui view. It needs to be gif image view. Okay nand. What we want to have here is a view of type gif image view.

There we go nwe can have no image here so let s add our views content mode. View dot content mode nto be scale aspect and i will choose fit because i don t want the gif to nbe overlapping or cutting off from this image view. So that is what we will use nand finally. Let s animate this so view.

Dot animate and we will use this with ngif named okay and i believe yes. It is called loading. There we go nand that should be it so we are animating with this loading gif okay nlet s build and run and see how that looks it is looking quite awesome okay now we don t want to animate this upon nthe first launch. So what we want to add in here is view dot view dot stop animating gif.

Okay there we go nand now we should not see any animation..


When we load our view there we go nokay that is it for the gif animation. And if you are interested only in doing this nthat is okay you can stop the video now. But we are going to integrate some nawesome logic to our app so we can download our dog png okay so what do we nwant to do next well first of all we want to set some logic for the nbutton tapped. So first of all we want to check.

If the view is animating that nimage view. So if loading gif is animating. So if animating gif. Then we want nto do something otherwise else so.

If the button is animating well basically we ndon t want to do anything. But if the button is not animating then we want to nstart animating. It so loading gif and start animating gif and then we want to nbasically download this image. The dog png.

So we will do that with the help of nour dispatch queue helper. So dispatch queue helper. There we go and we will ndelay by seconds with a completion handler. So we will wait let s say.

Five nseconds and then we will have our completion handler called and in this ncompletion handler. We will set the image views image to be our a dog. So let s open up our nlibrary with command shift l. Oh sorry with the command shift m.

And drag and ndrop our dog here and hit dot with rendering mode dot always original nbecause. If you add the template mode. You will have a blueish background. Okay nand that said here self because we are in the completion and now that we have our nimage downloaded let s stop this animation.

So loading gif stop animating ngif. Okay and basically that is it again nlet s add in here self now maybe we want to add in here exclamation. Mark and copy nall of this out there we go. Yeah.

And basically that is it finally we want to nmaybe maybe. Maybe. Yeah. Let s build and run.

And see how this looks like okay. Let s step on fetch image and the ngf is animating and after five seconds. We do get the dog added there nso for now let s just remove that background color. And did that animation go away it did nnot it just stopped the animation.

So what we want to do is remove the nanimation altogether so self dot gif loading gif dot alpha equals zero npoint zero and let s build run again there we go fetch image okay there we go and as a treat for you ni will create a reset so else we want to set the title of our button so button nset rather yet let s add this button to self dot button set title to reset and nit will be of state normal okay and that is that and then we want to set back notherwise. So the next step will be fetch image. So there you have it now you can nadd your very own gif files into your ios project with the help of gifu nnow. I hope you enjoyed this video.

If you did go ahead and give it a thumbs up nsubscribe to the channel and hit that notification bell. Now. It is your turn go nahead and comment down below how would ” ..

.

Thank you for watching all the articles on the topic Gif in UIImageView in Swift 5 with Gifu (Xcode 10.2) . All shares of star-trek-voyager.net are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.
description:

“Learn how to add a Gif into a UIImageView with Gifu in Swift 5 and Xcode 10.2!nnAdding a gif into your iOS app used to be a real pain. Fortunately there is Gifu – High-performance animated GIF support for iOS in Swift. In this video you will learn how to load GIF image in Swift. Now you can add gifs into your own apps as easily as you would add a UIImageView. In this video I ll show you how easy it is to add a gif with Swift into your app, and we will do a little demo too.nnLet s get to work!n____________________________________________________________________nDon t forget to download the resources: n https://store.rebeloper.com/youtube-channel-resourcesnnRESOURCES u0026 LINKS MENTIONED IN THIS VIDEO: nhttps://developer.apple.com/xcode/swiftui/ nhttps://developer.apple.com/tutorials/swiftui/creating-and-combining-viewsnn***VIDEOS I RECOMMEND***nnUIKit Tutorial Swift 2020n https://www.youtube.com/watch?v=hHQgHS7NHsou0026list=PL_csAAO9PQ8bjzg-wxEff1Fr0Y5W1hrumnniOS Development Tipsn https://www.youtube.com/watch?v=LEgZjH0tJNgu0026list=PL_csAAO9PQ8Y9MDrbOK_p1mgZtKOhDIvrnniOS Developer Essentialsn https://www.youtube.com/watch?v=4lq7l8YceM0u0026list=PL_csAAO9PQ8beK1WNovtuvs7vFM8p0b2HnnSWIFTUI EXAMPLEn https://www.youtube.com/watch?v=_wMsY7F9brAu0026list=PL_csAAO9PQ8aZ2kmFmyfTNfiRBZZTMpt1nnSWIFTUI TIPS AND TRICKSn https://www.youtube.com/watch?v=j7z2bsOsqYwu0026list=PL_csAAO9PQ8YzCQmaDdcOc7nLmht69ClznnSWIFTUI TUTORIALn https://www.youtube.com/watch?v=zucwLZoCs8wu0026list=PL_csAAO9PQ8Z1pbr-u6dSmDQTLZzDgcaPnnCLOUD FIRESTORE FOR IOS IN SWIFT 5 MASTER COURSEn https://www.youtube.com/watch?v=eo0WPFzLLEku0026list=PL_csAAO9PQ8bYAOhsIHX2PswXsJBF9P5SnnMVVM EXPLAINEDn https://www.youtube.com/watch?v=Razy8HjxK7Iu0026list=PL_csAAO9PQ8b2o8yifHJvv6JNDWCT3nKfnnMVVM IN SWIFTUIn https://youtu.be/EhtK_H9LsYQnnANONYMOUS SIGN IN WITH FIREBASE IN SWIFT 5n https://www.youtube.com/watch?v=m_TyAgt762Au0026list=PL_csAAO9PQ8ZqOuC1khL4Sb1Reons4g3onnMASTER AUTO LAYOUT WITH TINY CONSTRAINTS IN SWIFT 5n https://www.youtube.com/watch?v=ucbaEkEJKrcu0026list=PL_csAAO9PQ8ZHY2VzOi7LJ80CtfAgCgHPnnFIREBASE PASSWORDLESS SIGN INn https://www.youtube.com/watch?v=CXClHeZNlAEu0026list=PL_csAAO9PQ8aanonTKCoEB7J4YoxPdz2GnnDO YOU WANT TO BE MY APPRENTICE?nHIRE ME https://rebeloper.com/hire-us/nn__________nSay hi on social:nnGet in touch:n support@rebeloper.comnnSUBSCRIBE to weekly tips u0026 tutorials for building iOS apps!n https://www.youtube.com/rebeloper/?su…nnGithub: https://github.com/rebeloper/nHire me: https://rebeloper.com/hire-us/nLinkedIn: https://www.linkedin.com/in/rebeloper/nMy Blog: https://rebeloper.com/blognFollow me on Instagram: https://www.instagram.com/rebeloper/n_____nhttps://youtu.be/I1HthQ2oxUI”,

tags:
Gif in UIImageView in Swift 5 with Gifu, Gif in UIImageView in Swift 5, Gif in UIImageView, gif swift 4, gif ios, gif ios swift, gif xcode swift, gif swift 5…

Leave a Comment