iOS Swift Tutorial: Awesome Interactive Card View Animation with UIPropertyAnimator

  Рет қаралды 58,588

Brian Advent

Brian Advent

Күн бұрын

Пікірлер: 127
@pebiwhiper4616
@pebiwhiper4616 5 жыл бұрын
Thanks Brian, I'm an iOS developer here in Brazil and I'm learning a lot from your videos. Thanks for sharing and please continue with animations!
@coderacjhp9282
@coderacjhp9282 5 жыл бұрын
For fixing inaccessible problem with main view : 1- Hide visualEffectView after adding it as a subview to view (inside setupCardView method) 2- Show it in "animateTransitionIfNeeded -> frameAnimator -> case .expanded:" 3- Add this method below of "runningAnimations.append(blurAnimator)" blurAnimator.addCompletion { (_) in if state == .collapsed { self.visualEffectView.isHidden = true } } And that's it, your main view has been accessible. Happy coding..
@sujal1208
@sujal1208 4 жыл бұрын
Thank you. Holy fucking shit, I wasted two days figuring out how to implement the other code from another comment (which wasn't working) until I saw your comment. Holy, wow. just wow. Thank you.
@guitaripod
@guitaripod 2 жыл бұрын
Thanks
@MrAnonymous-j6l
@MrAnonymous-j6l 3 жыл бұрын
Thank you, this is so helpful, but the problem is that once I implement this feature I will never be able to interact with any components that are located at the Main View Controller (The Pumpkins View Controller)
@pratikgajbhiye5354
@pratikgajbhiye5354 4 жыл бұрын
kitna Sara Coding karta hai bhai tu...boht talented hai tu....
@cyangineer
@cyangineer 6 жыл бұрын
They added this API 2 years ago and I'm just now learning about this!? 🤯
@andrerussian4016
@andrerussian4016 4 жыл бұрын
yeah , this is a really awesome video
@mohamedosama6697
@mohamedosama6697 4 жыл бұрын
Amazing work Brian , thank you
@sreehari4219
@sreehari4219 5 жыл бұрын
@Brian Advent You missed the case that, in collapsed state, i pull up and pull down at the pan end. Then the cardViewController should remain collapsed.
@_deepak_joshi
@_deepak_joshi 5 жыл бұрын
I just found this bug, do you know how to fix this ?
@cleanrunyt
@cleanrunyt 3 жыл бұрын
awesome tutorial, thanks a lot!
@yutaranova
@yutaranova 6 жыл бұрын
Brian, it is a really awesome tutorial, thank you so much! Please, do more about property animator!)
@Emoryz
@Emoryz 4 жыл бұрын
It would be great to update this tutorial to show how this works in SwiftUI - any plans to do a video on this?
@takasurazeem
@takasurazeem 4 жыл бұрын
User interaction gets disabled on the parent view controller, how to fix that? Solution: self.visualEffectView.removeFromSuperview() self.cardViewController.view.removeFromSuperview() self.cardViewController.removeFromParent()
@mujtubaamin360
@mujtubaamin360 4 жыл бұрын
Where we have to place this code?
@takasurazeem
@takasurazeem 4 жыл бұрын
@@mujtubaamin360 where you need that to be removed or just simply disable and enable user interaction on the FX Layer.
@mohamedosama6697
@mohamedosama6697 4 жыл бұрын
you saved my day bro really thank you
@takasurazeem
@takasurazeem 4 жыл бұрын
@@mohamedosama6697 you can play with user interactivity property too.
@joandaa
@joandaa 3 жыл бұрын
@@vrushabhrupala8663 I am so late, but heres the solution to that visualEffectView.isUserInteractionEnabled = false
@jimenaleonbm
@jimenaleonbm 5 жыл бұрын
Thanks Brian, I have a question, How can I interact with first ViewController? , where you have the background of the pumpkins if I want to add a button this doesn't work.
@rodrigobuendiaramos3076
@rodrigobuendiaramos3076 5 жыл бұрын
Were you able to figure it out? I have the same problem.
@bitsnbytes398
@bitsnbytes398 4 жыл бұрын
it's too late for reply but visualEffectView.isUserInteractionEnabled false and true work for me
@enochjohnson
@enochjohnson 4 жыл бұрын
@@bitsnbytes398 How would you do that?
@bitsnbytes398
@bitsnbytes398 4 жыл бұрын
@@enochjohnson in viewdidappear write this line. self.visualEffectView.isUserInteractionEnabled = true when collapsed call self.uibutton.isUserInteractionEnabled = true
@tolulopeaboyeji5373
@tolulopeaboyeji5373 4 жыл бұрын
SyedMUmer Sajjad thanks
@DannyBoy443
@DannyBoy443 4 жыл бұрын
Why did you use a ternary operator for cardVisible return? And why did you put . infront of collapsed and expanded? I'm new to Swift so I'm learning. Thanks
@noobmaster3k
@noobmaster3k 7 ай бұрын
It's worked really well but as soon as we add it into tab bar controller it broke, how do we fix it?
@danielprast
@danielprast 4 жыл бұрын
What an amazing tutorial, thanks! 👍
@marioguerrero1311
@marioguerrero1311 3 жыл бұрын
Bryan, How do you know that much? I don't wanna sound rude but I have been learning day in day out from one year now and this seems to be endlessly, do you follow any special books or any straightforward documentation? I really would like to know it, because I notice it's better to know how the system works instead of making learning tutorials forever and ever.
@MD-S282
@MD-S282 6 жыл бұрын
Hi Brian, I love your videos, thank you for your clarity. Just wondering if you could show some more features of the Charts framework? Also, I'm not sure if you've done this already, but would you be able to explain how to take content from an image view (or Chart view) and export to pdf and/or attach to email? Thank you!
@DiegoAlejandroArizaMedina
@DiegoAlejandroArizaMedina 5 жыл бұрын
⭐️⭐️⭐️⭐️⭐️ What a great video and material, thank you very much for this video, I want to ask you what should be modified so that the "CardViewController.xib" does not occupy the full width of the screen.?
@clintonbissong5723
@clintonbissong5723 4 жыл бұрын
Hello Brian, i just watched your tutorial now and applied it on a mapView and after that the mapView became inactive, u can seem to do anything on it, i guess its blc theres a new view added on it, can you help me solve this issue please.
@jeanmif
@jeanmif 4 жыл бұрын
Hello, I have followed step by step your explanations, and the func cornerRadiusAnimator doesn't work and I get an Optional error that appears with the func blurAnimator, because on case .expanded I receive first a nil. how can i fix that? many thanks for the help.
@forrestanderson2885
@forrestanderson2885 5 жыл бұрын
Excellent tutorial. Thank you.
@huyopen
@huyopen 4 жыл бұрын
great tutorial
@seanperez9249
@seanperez9249 4 жыл бұрын
Great video! Thanks! Please read the Swift Style Guide though to improve your formatting. It will greatly help my OCD while watching you code lol.
@RAMSESmusicofficial
@RAMSESmusicofficial 6 жыл бұрын
I thing that using fractionComplete is a pretty bad way to make card view. I have a better way, with pan gesture recognizer you can change y position of card view and depending on that position trigger animation when pan gesture ended. For example, when card view is expanded its y position is 100 and when it’s retracted it’s y position is 10 and depending on current y position trigger animation, is y pos is lower than 60 then the card view animate to retracted state and if it is greater than 60 it will animate to expanded state. Also pan recognizer have a velocity property so you can also change state depending on that.
@UdayBabariya
@UdayBabariya 5 жыл бұрын
little suggestion for "handlePan" case .ended: let translation = recognizer.translation(in: self.viewHandler) var fractionComplete = translation.y / self.viewCard.frame.height fractionComplete = cardVisible ? fractionComplete : -fractionComplete if fractionComplete < 0.3{ cardVisible = false for animator in runningAnimations{ animator.stopAnimation(false) } self.runningAnimations.removeAll() animateTransitionIfNeeded(state: nextState, duration: 0.5) }else{ continueInteractiveTransition() } by this the card view will get back to .expanded state if user dont want to .collapsed state each time
@So4i94
@So4i94 5 жыл бұрын
You are the best. Many thanks!
@VTL7
@VTL7 2 жыл бұрын
Please help, how can we open this card by tap on Cell in CollectionView ?
@cyn89110
@cyn89110 4 жыл бұрын
Hi Brian, I think animationProgressWhenInterrumpted is not needed, property framtionComplete of animator will set automatically when pauseAnimation().
@akshaykumar-qj2kx
@akshaykumar-qj2kx 4 жыл бұрын
Main View Controller is not working after adding cardviewcontroller
@stevengao8345
@stevengao8345 6 жыл бұрын
thanks for this great tutorial, do you already have a course that is doing animation like App Store, tap an app image, the app go smoothly take up full screen with some sprint animation ? thanks
@nickhung145
@nickhung145 2 жыл бұрын
How to preset to start with Expand?
@rodrigobuendiaramos3076
@rodrigobuendiaramos3076 5 жыл бұрын
I am trying to implement a search bar in the view. However, I am having trouble when the keyboard appears and disappears. I am thinking the best approach would be to create a "third" state to handle a semi-collapsed view?
@akshaykumar-qj2kx
@akshaykumar-qj2kx 4 жыл бұрын
Awesome : ) Brain . Thanks for sharing your knowlege :) Appreciate your work :) Well Done :)
@prashantt727
@prashantt727 6 жыл бұрын
Great video but What about safe area support ? can you do something with it. One more thing suppose next state is collapse and User move his finger to up (he wants keep it expanded) in this case can we reverse the animation with velocity Hope you are getting my point
@prashantt727
@prashantt727 6 жыл бұрын
Here How I achieved it in Pan gesture continueAnimation(finalVelocity: recognizer.velocity(in: self.cardViewController.handlerArea)) func continueAnimation (finalVelocity:CGPoint) { print(cardVisible == (finalVelocity.y < 0)) if cardVisible == (finalVelocity.y < 0) { var completedFraction:CGFloat = 0 for animation in animations { completedFraction = animation.fractionComplete animation.stopAnimation(false) } animations.removeAll() self.cardVisible = !self.cardVisible self.createAnimation(state: nextState, duration: TimeInterval(completedFraction * 0.9)) } else { for animation in animations { animation.continueAnimation(withTimingParameters: nil, durationFactor: 0) } } }
@cementerioclub_86
@cementerioclub_86 4 жыл бұрын
One question. I have lost interactivity with the back VC. Any Idea how can I regain it ?
@takasurazeem
@takasurazeem 4 жыл бұрын
self.visualEffectView.removeFromSuperview() self.cardViewController.view.removeFromSuperview() self.cardViewController.removeFromParent() *wink*
@pierogfgenoveseII
@pierogfgenoveseII 4 жыл бұрын
How would you do to swipe down from collapsed state to dismiss the view?
@lmfao7224
@lmfao7224 6 жыл бұрын
how would you go about adding scrollable content inside of the "card view". is it possible to move the y position of the card as the content scrolls?
@666MrGamer
@666MrGamer 6 жыл бұрын
I would love to know that as well!
@MaximGolovlev
@MaximGolovlev 6 жыл бұрын
just add this to your card controller extension CardViewController: UIGestureRecognizerDelegate { func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { let offest = scrollView.contentOffset let v = (gestureRecognizer as! UIPanGestureRecognizer).velocity(in: nil) return v.y > abs(v.x) && offest.y Bool { return true } }
@talezion
@talezion 5 жыл бұрын
@@666MrGamer Add a `UITableView`
@robertwensley7514
@robertwensley7514 5 жыл бұрын
This is the best way to add scrollable content to the "card view": kzbin.info/www/bejne/b5SofptnbrVgiJY Make sure to offset the y-position of the scrollable content by adding this code to the setupScrollView function (otherwise the animations won't work): scrollView.topAnchor.constraint(equalTo: view.topAnchor, constant: 20).isActive = true
@nuhanabilah_
@nuhanabilah_ 5 жыл бұрын
Thank you for your video, helps me a lot
@eldarkk4566
@eldarkk4566 4 жыл бұрын
Brian damn you are Swifty Gangster
@ProNoobsful
@ProNoobsful 5 жыл бұрын
i try to change label inside Card View when is .expanded and i get a BUG, hes automaticly collapsed.... i think animation stoped when a changed label how fix it?.
@afeefsohail4869
@afeefsohail4869 4 жыл бұрын
If i want to add 3 stages 1st fullexpand or halfexpand and Collapsed.
@indiraamangeldinova2180
@indiraamangeldinova2180 5 жыл бұрын
thanx a lot!! it's REEAALLYY awesome!! thousands likes
@Sniiigel
@Sniiigel 5 жыл бұрын
Are the horisontal gray lines by default or are they manually added?
@UdayBabariya
@UdayBabariya 5 жыл бұрын
Really Helpfull 👍🏻
@abisai7483
@abisai7483 5 жыл бұрын
How to achieve navbar button click to wakeup also landscape not working properly.
@robertwensley7514
@robertwensley7514 5 жыл бұрын
@BrianAvent When this card is added over a tableview, it breaks the tableview's ability to scroll. Any idea how to resolve that issue?
@ipetrovbg
@ipetrovbg 5 жыл бұрын
It's because of the visual effect added as a sub view
@WaK39c
@WaK39c 11 ай бұрын
Somebody resolved this bug with tableView?
@TheiTeckHq
@TheiTeckHq 5 жыл бұрын
Hi Brian, thanks for this video. I wanted to ask how to go about getting the three states instead of just two. (collapsed & expanded). Say I want the card to go from 0 to 150. Then a further swipe up should expand it fully else a swipe down should collapse it. You can see something in Shortcuts app on iOS. Any idea or help will be appreciated. Thanks!
@abdalmagidulmagbub8836
@abdalmagidulmagbub8836 4 жыл бұрын
wooow wow woooow thank you very much that was amazing
@andrew7675
@andrew7675 5 жыл бұрын
I have this card running over another view, but I can’t press a button on the bottom view, please help
@andrew7675
@andrew7675 5 жыл бұрын
Nevermind just removed blur view
@coderacjhp9282
@coderacjhp9282 5 жыл бұрын
You don't need to remove it just follow my steps below 1- Hide visualEffectView after adding it as a subview to view 2- Show it in "animateTransitionIfNeeded -> frameAnimator -> case .expanded:" 3- Add this method below of "runningAnimations.append(blurAnimator)" blurAnimator.addCompletion { (_) in if state == .collapsed { self.visualEffectView.isHidden = true } } And that's it, your main view has been accessible. Happy coding.. @@andrew7675
@ikxni
@ikxni 5 жыл бұрын
@@coderacjhp9282 Could you please elaborate on the first and second steps, its being troublesome to get it working :(
@robertwensley7514
@robertwensley7514 5 жыл бұрын
@@coderacjhp9282 You're awesome! I banged my head against the keyboard for way too long trying to solve this one!
@ReasonableTechReviewer
@ReasonableTechReviewer 5 жыл бұрын
@@coderacjhp9282 Thank you! But I can only access the main view after I have dragged the card view up and down once. Is there a way of solving this? Thanks in advance!
@mehdiabdi3773
@mehdiabdi3773 6 жыл бұрын
WooooooW 😍 Awesome
@jonyive6273
@jonyive6273 4 жыл бұрын
how to add card in all screen (hole project)???
@gopalkrishan92
@gopalkrishan92 6 жыл бұрын
Very helpful and learning video
@shingetzu88
@shingetzu88 6 жыл бұрын
Hi Brian, what if I want the image to scale down to 1/3 of the screen and the card to occupy 2/3? How can I do the scaling instead of blur?
@AvenCode
@AvenCode 6 жыл бұрын
Great tutorial! Thank you, just in time! I bought all your courses in Udemy. Please, when you will update your CoreData course - add some instructions how to use iCloud container to sync data between devices or at list how to save it on iCloud Drive.
@30guarino
@30guarino 6 жыл бұрын
"Just had to copy and paste my comment" Good luck lol....I've been trying to get the Udemy instructors to update their content for months on the Courses I purchased for "iOS 12 and Xcode 10" and it seems like only thing that got updated was the TITLE!!
@tariqAlmazyad
@tariqAlmazyad 4 жыл бұрын
Evgenii Turchaninov CoreData is kinda slow , take a look as Realm
@nutsilog
@nutsilog 4 жыл бұрын
Hi Brian, I followed this tutorial and added some additional frame animation of a UILabel to it. It doesn't seem to work on tap gesture though, even if it's working correctly on a pan gesture. I'd be happy to share you the source code. Can you help me with this, please?
@nutsilog
@nutsilog 4 жыл бұрын
switch nextState { case .expanded: self.cardVC.view.frame.origin.y = 0 self.cardVC.enterNumberLabel.frame.origin.y = self.cardVC.handleView.frame.minY + 24 // this doesn't work on tap, but working on pan gesture case .collapsed: self.cardVC.view.frame.origin.y = self.view.frame.height - self.cardHeightWhenCollapsed self.cardVC.enterNumberLabel.frame.origin.y = self.cardVC.handleView.frame.minY - 24 // this doesn't work on tap, but working on pan gesture }
@JCatl3y
@JCatl3y 6 жыл бұрын
I’d love to see a tutorial on how to add a character selection menu and the ability to change characters in games. 📱👾👽🤖
@muazfarooq8999
@muazfarooq8999 6 жыл бұрын
@brian Kindly let me know how sms verification use in Swift
@aliakkawi4759
@aliakkawi4759 6 жыл бұрын
This is Awesome, thanks
@AhmedMahmoud-te5wh
@AhmedMahmoud-te5wh 6 жыл бұрын
Thanks for sharing 😍
@bhushankumar6838
@bhushankumar6838 5 жыл бұрын
how can we put as a button action please reply
@TheFirzoknadeem1
@TheFirzoknadeem1 5 жыл бұрын
I have a map view on the background and a floating window but when I add the floating window it completely replaces the background (a white screen comes where the map should be displayed) any idea how I can fix this ?
@dmitrygrin6930
@dmitrygrin6930 5 жыл бұрын
Did you find a solution? I have the same issue :D
@TheFirzoknadeem1
@TheFirzoknadeem1 5 жыл бұрын
@@dmitrygrin6930 Yes I added the floating window at position 2 and it worked for me
@rodrigobuendiaramos3076
@rodrigobuendiaramos3076 5 жыл бұрын
@@TheFirzoknadeem1 can you interact with the map view that you have in the background?
@TheFirzoknadeem1
@TheFirzoknadeem1 5 жыл бұрын
@@rodrigobuendiaramos3076 yes
@hassansfilms
@hassansfilms 6 жыл бұрын
thanks a lot man!
@longhoanggiang
@longhoanggiang 6 жыл бұрын
Thanks briant
@jontierney3976
@jontierney3976 6 жыл бұрын
Thanks!
@marcinfrydrych5319
@marcinfrydrych5319 6 жыл бұрын
Are you sure the SpriteKit course on udemy is up to date?
@30guarino
@30guarino 6 жыл бұрын
Good luck lol....I've been trying to get the Udemy instructors to update their content for months on the Courses I purchased for "iOS 12 and Xcode 10" and it seems like only thing that got updated was the TITLE!!
@walmosawi
@walmosawi 5 жыл бұрын
very nice
@muhammedasif7895
@muhammedasif7895 5 жыл бұрын
you are amazing
@alwaleedalabri3927
@alwaleedalabri3927 5 жыл бұрын
I've dropped a text field & I covered the main storyboard with map view, it worked but I can't use then in the simulator, Its like the Card view blocking the the screen. Please help
@kleon790
@kleon790 5 жыл бұрын
yes thats happen because UIVisualEffectView() layer is covering the whole view
@BGang
@BGang 5 жыл бұрын
@@kleon790 Any solution?
@adamkenton2585
@adamkenton2585 5 жыл бұрын
Why dont you start really from scratch ? I'm a beginner and I have no idea CardViewController xib file, and not just that the other files too..
@mohammadmohsin2863
@mohammadmohsin2863 4 жыл бұрын
Anyone please guide me how can i implement above with TabBarViewController which also have navigation bar.Please
@DmitryKatsubo
@DmitryKatsubo 6 жыл бұрын
2 likes! but it impossible )
@aliquewilliams3080
@aliquewilliams3080 6 жыл бұрын
Not at all an effective way of doing this. You shouldn't couple the cardViewController to any other viewController.
@sami790311
@sami790311 6 жыл бұрын
The purpose of this video is not clean architecture.
@shingetzu88
@shingetzu88 6 жыл бұрын
Alique, what do you mean? What is a better way of doing this then?
@supersquare
@supersquare 5 жыл бұрын
@@shingetzu88 Did you ever find an answer to this?
@shingetzu88
@shingetzu88 5 жыл бұрын
@@supersquare no. :(
@mkhasson97
@mkhasson97 6 жыл бұрын
1st
@muazfarooq8999
@muazfarooq8999 6 жыл бұрын
And kindly give me grocery store Making tutorial
@wassifmeskine3328
@wassifmeskine3328 4 жыл бұрын
why you create a cardViewController and left it empty ?
@БЕОГРАДСКАБАНДА
@БЕОГРАДСКАБАНДА 4 жыл бұрын
How to attach view to Referencing Outlets?
iOS Swift Tutorial: Material Design Onboarding with Cool Animations
31:01
Wait… Maxim, did you just eat 8 BURGERS?!🍔😳| Free Fire Official
00:13
Garena Free Fire Global
Рет қаралды 9 МЛН
I tricked MrBeast into giving me his channel
00:58
Jesser
Рет қаралды 28 МЛН
Swift Animations: Custom Counting Label - CADisplayLink
21:43
Lets Build That App
Рет қаралды 34 М.
PanGesture slide-in half modal Bottom Card tutorial for UIKit + Swift
14:46
Build Carousel Effect in iOS with Swift
37:47
David Tran
Рет қаралды 53 М.
Swift: How to Chain Animations for Impressive Visual Effects
17:21
Lets Build That App
Рет қаралды 53 М.
One CPU To Rule Them All - Ryzen 7 9800X3D Review
12:47
Linus Tech Tips
Рет қаралды 974 М.
Wait… Maxim, did you just eat 8 BURGERS?!🍔😳| Free Fire Official
00:13
Garena Free Fire Global
Рет қаралды 9 МЛН