PanGesture slide-in half modal Bottom Card tutorial for UIKit + Swift

Поделиться
HTML-код
  • Опубликовано: 5 ноя 2024

Комментарии • 72

  • @nikoszacharakis992
    @nikoszacharakis992 Год назад +1

    Hi Aivars, thank you very much for a great and helpful presentation. I was surfing the internet for a decent and simple solution and luckily I stumbled across yours. Congratulations for the well defined explanations and the clarity of your video. Take care 🙂

  • @timmyfrank3
    @timmyfrank3 3 года назад

    Hey man I just want to say this is a massive help. I have spent countless hours watching tutorials on this type of slide-up bottom card that are only like 50% as good and theres always some glitchy part or something isnt quite right. This tutorial does it completely perfectly. It looks so professional. Thank you so much you have earned another subscriber.

    • @AivarsMeijers
      @AivarsMeijers  3 года назад +1

      Thank you for letting me know this! That's for sure a bit of extra effort to make a tutorial or something that you just figured out how to do, but that's very rewarding to hear back from guys like you, for whom that was helpful :)

  • @gallivantdiaries9457
    @gallivantdiaries9457 3 года назад +2

    Out of all the tutorials I've seen on this feature, this is by far the best one. Ive watched videos that are at least 30 mins long and here you are smashing it in 15 minutes! Thanks and subscribed :)

  • @karensuki18
    @karensuki18 2 года назад

    Thanks for the tutorial! And the dog is cute! Hehe

  • @starlol122
    @starlol122 9 месяцев назад

    Brilliant and very helpful code!!! Thanks a lot!!!

  • @GeorgeOprea10
    @GeorgeOprea10 3 года назад +1

    I know this is maybe a little old to receive a reply but how do you pass parameters from the ViewController to the OverlayView: UIViewController. I have a hard time adding the necessary initializers/init.
    By the way, this is a great tutorial and I wish I saw more tutorials from you.

    • @AivarsMeijers
      @AivarsMeijers  3 года назад +1

      I'm passing size only to the UIPresentationController if that should be dynamic
      All the other parameters for the screen, buttons, etc are in UIViewController which is presented by UIPresentationController.

  • @yannikhornschemeyer6102
    @yannikhornschemeyer6102 2 года назад

    For everyone wondering how to change the height dynamically: inside the PresentationController class in the init function, check the presentingViewController with an if statement like "if presentingViewController.className == "YourVC", height = 50" and then inside the frameOfPresentedVC function set the height to the global height variable.
    To get the class name, you need to write an extension somewhere:
    extension ViewController {
    var className: String {
    NSStringFromClass(self.classForCoder).components(separateBy: ".").last!
    }
    }
    Don't forget to implement the delegate method mentioned in the video, otherwise your presentingViewController will return nil.

  • @alvarosanchez1003
    @alvarosanchez1003 3 года назад +1

    How can i change the value of a label of the .xib, it retun me a nib. Thanks

  • @irsyadashari5536
    @irsyadashari5536 4 года назад +1

    finally ! my favorite youtuber

    • @AivarsMeijers
      @AivarsMeijers  4 года назад

      Thank You :) This time tutorial

    • @irsyadashari5536
      @irsyadashari5536 4 года назад

      @@AivarsMeijers Thank u for saving us our time! I appreciate it

  • @triplem1345
    @triplem1345 2 года назад

    Hey Aivars, I know this is an older tutorial, but maybe you can help anyways.
    How to modify the code, so that the view appears from the left and dismisses to the right again (instead from bottom to top). Or does it require massive code changes?
    Thanks for the great tutorial by the way

    • @AivarsMeijers
      @AivarsMeijers  2 года назад

      Oh, its beed a while since I created that tutorial. There was file where I specify how far slider should go and so one, also I used screen coordinate system to device from where it comes. That could be changed, but dismissing to another side would be significant change.

  • @sophiabnrm8730
    @sophiabnrm8730 3 года назад

    Hello Aivars! First of all: great tutorial! not too long, not too short. I could follow along and didnt feel lost in between! Thanks for that!
    I did however run into a problem with the code and I hope you could help:
    When I swipe and hold the overlayed view really fast up and down, then it freezes. It seems as it does not recognize the "sender.state == .ended" when swiping quickly up and down.
    Do you by chance know a solution to this problem?

    • @AivarsMeijers
      @AivarsMeijers  3 года назад

      Unfortunately, I can't help you with this issue. Didn't run into that when used it in production, now I'm mostly into SwiftUI for user interface development.

  • @cem890
    @cem890 3 года назад

    Thank you very much !! I have a question.Why aren't viewdidLoad,ViewWillAppear methods fired in viewController after dismissing the card?

    • @AivarsMeijers
      @AivarsMeijers  3 года назад

      I doubt it should. View is already loaded. You can trigger action on Presenter disappear action. Use delegates for that

  • @edorfs
    @edorfs 3 года назад

    Hello, I want to ask a question. There is more than one button on the page and I want to open different heights of each button when clicked. How can I change the page height for each page. Thank you for answer.

  • @VTL7
    @VTL7 2 года назад

    Здравствуйте) Огромное спасибо за этот опыт!!! Подскажите как правильно изменить в коде, что бы оно не полностью вниз дисмиссилось, а оставалось на экране внизу полоской (с серой полоской) ?

    • @AivarsMeijers
      @AivarsMeijers  2 года назад

      Oh, I made that so long ago ... here what I see in my production code;
      Screen should be dismissed calling function :
      @objc func dismissController(){
      self.presentedViewController.dismiss(animated: true, completion: nil)
      }
      So, you can change height of the popup view in that function insted of calling .dismiss
      Hight of the screen is defined in : override var frameOfPresentedViewInContainerView: CGRect {
      I would try to change that

    • @VTL7
      @VTL7 2 года назад

      @@AivarsMeijers Understand))) Great, thanks for the direction and answer , I will try it👍🏼👍🏼👍🏼)

  • @pyj0831
    @pyj0831 2 года назад

    First of all, thank you so much for the good lecture. I tried a half-modal View after watching your lecture, but I'm having a hard time with the height of the model view. Even though I did exactly the same as your code, in my simulator, the modal view comes up to the end, not half. I cloned your project and copied and pasted all the codes because I thought there was a problem with my code, but the results were the same. Can I know what the problem is...?

    • @AivarsMeijers
      @AivarsMeijers  2 года назад

      Hard to say what could be the problem if demo project dosen't work. Obviously Apple changed something in Xcode or UIKit and that broke implementation.
      I see that it still works just fine in project where I'm using that functionality, but didn't test demo project with newest Xcode,.

    • @pyj0831
      @pyj0831 2 года назад

      @@AivarsMeijers Thank you for your answer! I've tried more since I left a comment, but I haven't solved it yet. I'll study more and solve it :)

  • @angelinafriz3977
    @angelinafriz3977 3 года назад

    awesome! you saved my day! thank you very much!

  • @getbiks
    @getbiks 4 года назад

    Thanks for this amazing guide.. One thing missing is to give it a dynamic height based on the content. Any tips on how we can implement it?

    • @amaanshah1147
      @amaanshah1147 3 года назад

      @getbiks Did you figure out how to do this? I’m trying to do the same thing.

    • @sarathkumarsekar4713
      @sarathkumarsekar4713 3 года назад

      @@amaanshah1147 Did u got dynamic height?

  • @Xaxxus
    @Xaxxus 2 года назад

    is there a way to allow interaction with the view controller in the back? Sort of like how apple maps works?

    • @AivarsMeijers
      @AivarsMeijers  2 года назад

      Sure you can do that. I used protocols for interaction handling between views.

  • @hikmetisldak7682
    @hikmetisldak7682 4 года назад

    Thank you master ✨

  • @sarunpornpisutwimol
    @sarunpornpisutwimol 3 года назад

    Thank you very much! you save my life.

  • @swiftlandacademy3193
    @swiftlandacademy3193 3 года назад

    Really nice... thanks

    • @AivarsMeijers
      @AivarsMeijers  3 года назад

      Thank you too! Thanks for watching 👍
      I heard that it is easier to do that now in UIKit after WWDC, but didn't take a look, because spending most of the time in SwiftUI now

  • @SsmarcosS41
    @SsmarcosS41 3 года назад

    amazing

  • @__bozo__
    @__bozo__ 4 года назад

    How stable is Big Sur beta? Can I use it as my primary system to develop iOS apps?

    • @AivarsMeijers
      @AivarsMeijers  4 года назад

      It is ok, using it daily for at leat month. Do not see problems with Apps what I use daily. Yeah, sometimes Xcode crashes, but that happened on a production version once in a while as well

  • @vladshima9
    @vladshima9 Год назад

    Классно, давай еще UIKit

    • @AivarsMeijers
      @AivarsMeijers  Год назад +1

      I'm balls deep in SwiftUI now, using UIKit only on one older project.

  • @georgesudnik
    @georgesudnik 4 года назад

    Uzreiz redzams, meistars!

  • @roh9934
    @roh9934 3 года назад

    i tried to change the height in storyboard but it isnt changing.

    • @AivarsMeijers
      @AivarsMeijers  3 года назад

      Nope, you should change size configuration in code. Check out other comments, I answered this already. I’m on phone, can’t check code now.

    • @roh9934
      @roh9934 3 года назад

      @@AivarsMeijers ok, resolved it..

    • @tabishshaikh2338
      @tabishshaikh2338 2 года назад

      @@roh9934 hi

    • @tabishshaikh2338
      @tabishshaikh2338 2 года назад

      @@roh9934 how did you do it?

  • @aleksandrandrukhov9554
    @aleksandrandrukhov9554 4 года назад

    Nice, but when do you making video about android?)

    • @AivarsMeijers
      @AivarsMeijers  4 года назад +1

      I'm working on iOS only. If will decide one day to start Android project, then will do ¯\_(ツ)_/¯

  • @atharvsharma6916
    @atharvsharma6916 4 года назад

    Hi please suggest how can we handle backend for the apps?

    • @AivarsMeijers
      @AivarsMeijers  4 года назад

      Firebase. Easy to learn and free for up to medium size projects

  • @sarathkumarsekar4713
    @sarathkumarsekar4713 3 года назад

    How to change the height in running time?

    • @AivarsMeijers
      @AivarsMeijers  3 года назад

      Change return value in "override var frameOfPresentedViewInContainerView: CGRect {"
      I'm using enum to configure different sizes for different use cases

  • @roh9934
    @roh9934 3 года назад

    can you tell me how to close it using like the "subscribe" button or something? please its urgent

    • @AivarsMeijers
      @AivarsMeijers  3 года назад

      There is a function to dismiss controller:
      "@objc func dismissController(){
      self.presentedViewController.dismiss(animated: true, completion: nil)
      }"
      I created a protocol and called dismiss function from it.

    • @roh9934
      @roh9934 3 года назад

      @@AivarsMeijers You are a life saviour, you know that?

  • @NuwanThisara
    @NuwanThisara 4 года назад

    first thought... and a suggestion... content, specially text can hardly be read because I am watching this on a small screen. please consider about that next time. You are recording on a larger screen.

    • @AivarsMeijers
      @AivarsMeijers  4 года назад

      Right, sorry about that. I realised that only during editing. There is GitHub with all the project files linked below, please use them to do not write manually all that code.

  • @surendrareddy8374
    @surendrareddy8374 3 года назад

    I am trying to drag to top but, not working 🧐

    • @AivarsMeijers
      @AivarsMeijers  3 года назад

      Check out link to the GitHub with demo project and try if that works

    • @surendrareddy8374
      @surendrareddy8374 3 года назад

      @@AivarsMeijers tried with GitHub demo project, but it’s not working, can You help me out for this move to top and there is no code for move to top in the GitHub demo project.

    • @AivarsMeijers
      @AivarsMeijers  3 года назад

      @@surendrareddy8374 Ah, you are dragging to the top. Ok, clear, there is size limitation for the popup sheet.
      Check out: class PresentationController
      Play around with this function:
      override var frameOfPresentedViewInContainerView: CGRect {
      CGRect(origin: CGPoint(x: 0, y: self.containerView!.frame.height * 0.4),
      size: CGSize(width: self.containerView!.frame.width, height: self.containerView!.frame.height *
      0.6))
      }

    • @surendrareddy8374
      @surendrareddy8374 3 года назад

      @@AivarsMeijers this function is increasing the pop up sheet but my requirement is
      Initially I have to show half of the bottom sheet like 500 height .. but when the user moves to the up it should move to a bit up like 600

    • @vparage
      @vparage 2 года назад

      @@surendrareddy8374 How were you able to achieve this? Any Suggestion will be helpful. Thanks

  • @vitaliy5051
    @vitaliy5051 4 года назад

    you saved my ass!