FASTEST way to Make a CAMERA APP with Swift AVFoundations

Поділитися
Вставка
  • Опубліковано 24 лип 2024
  • FASTEST way to Make a CAMERA APP with Swift AVFoundations
    Escape Tutorial Hell 👉 rebeloper.com/mentoring
    You have to know everything about avfoundation in order to build a decent app.
    Want to learn avcapturedevice and swift avfoundation, then this video is perfect for you! In this iOS AVFoundation video you will learn about avvideocompositioncoreanimationtool, audio player, swift camera, swift do catch and swift basics in general. You will learn how to create snapchat with the help of this avfoundation tutorial. In this camera tutorial I will walk through things like avkit vs avfoundation, custom camera swift, swift audio player and much more! This avvideocompositioncoreanimationtool tutorial is a swift course. These swift for beginners videos will teach you how to learn swift programming and swift app development. Don’t forget to subscribe to my UA-cam channel for more swift 5 tutorial and swift ios development. I talk a lot about ios software, ios play music and SwiftUI.
    So if you want to learn AVFoundation then keep watching!
    Let's dive into this AVFoundation video by Rebeloper!
    Don’t forget to download the resources:
    → store.rebeloper.com/youtube-c...
    **VIDEOS I RECOMMEND**
    → PLAYLIST:
    Navigation:
    • Navigation in SwiftUI ...
    DO YOU WANT TO BE MY APPRENTICE?
    HIRE ME → rebeloper.com/hire-us/
    TOOLS I RECOMMEND:
    → rebeloper.com/tools
    __________
    Say hi on social:
    Get in touch:
    → support@rebeloper.com
    SUBSCRIBE to weekly tips & tutorials for building iOS apps!
    → ua-cam.com/users/rebeloper?su...
    Github: github.com/rebeloper/
    Hire me: rebeloper.com/hire-us/
    LinkedIn: / rebeloper
    My Blog: rebeloper.com/blog
    Follow me on Instagram: / rebeloper
    ____
    • FASTEST way to Make a ...
    #rebeloper
    CHAPTERS:
    _____
    00:00 INTRO
    00:21 THE PLAN
    02:06 CAMERA SERVICE
    16:10 CAMERA VIEW
    27:16 CUSTOM CAMERA VIEW
    33:00 SHOW AND USE CAMERA
    39:45 WHAT TO DO NEXT
  • Наука та технологія

КОМЕНТАРІ • 81

  • @rebeloper
    @rebeloper  2 роки тому +8

    Do you think using AVFoundation is easy?

    • @jsonbourne8122
      @jsonbourne8122 Рік тому +1

      Not quite, fortunately there are many examples online

    • @wesleykelemen6749
      @wesleykelemen6749 Рік тому +1

      @@jsonbourne8122 Of camera app using SwiftUI? Please send the links lol

  • @MrLawaghar
    @MrLawaghar 2 роки тому

    You absolutely right. Very few tutorial on UA-cam but they are not up to the mark but you rock iiiiiiiittttttt.

    • @rebeloper
      @rebeloper  2 роки тому

      Glad I could help! :) BTW check out a video about THE MISSING view from SwiftUI: ua-cam.com/video/cUnxa87qNoQ/v-deo.html

  • @AchimFriedland
    @AchimFriedland Рік тому

    Thank you for this tutorial.
    The only strange thing I'm facing is with the front camera of an iPad Air 5th generation. The camera picture within the preview view looks nice and has warm colors, but the UIImage fetched from the camera seems to have a bit colder colors and looks like the photo was saved as low quality JPEG... so a lot of artifacts. Where does this come from? Because it is not within the code. Does iOS do any automagics?
    On an iPhone 12 Pro everything looks much better, but still there is a big difference between the preview and the final image.

    • @rebeloper
      @rebeloper  Рік тому

      Hmm... that's frustrating. Unfortunately I don't have answer for this.
      BTW here are 6 things I wish I knew about SwiftUI when I started 👇
      ua-cam.com/video/EZz9NL4H0Ug/v-deo.html

  • @shingetzu88
    @shingetzu88 2 роки тому

    This is really great! Can you make a follow up video on this using UIKit instead and adding focus/autofocus and other settings like flash? Thank you.

    • @rebeloper
      @rebeloper  2 роки тому +1

      Thanks for the compliment. Unfortunately i am not using UIKit for 1.5 years now. BTW Did you know? Apple is Finally FIXING SwiftUI at WWDC (My Wish List) 👉 ua-cam.com/video/CbjESSsCogo/v-deo.html

  • @reemaalwaneen2472
    @reemaalwaneen2472 7 місяців тому

    you're amazing, thank you!

    • @rebeloper
      @rebeloper  7 місяців тому +1

      Happy to help! Also check out How to Develop iOS and macOS Apps in VSCode 👇
      ua-cam.com/video/yWdC5Kg6nIA/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @angelsflorea8698
    @angelsflorea8698 Рік тому +1

    Hey! amazing video! I was wondering what would be the steps if user wants to post the captured photo in the app

    • @rebeloper
      @rebeloper  Рік тому

      You can use Firebase for that. Let me show you on a mentoring session: rebeloper.com/mentoring
      BTW Becoming A Front End Developer Takes Time 👉 ua-cam.com/video/Hx2tE19jYn8/v-deo.html

  • @sidsudhir8231
    @sidsudhir8231 2 роки тому +3

    How different would this be if we wanted to record a video instead? I would like to make an app that records videos and saves it locally

    • @rebeloper
      @rebeloper  2 роки тому

      This can be the basis for a video capture app. You need to add a bit more complex code though. BTW if you did like this video I think you will enjoy "How to Publish an App to the App Store": ua-cam.com/video/ykiD5wqwSe4/v-deo.html

  • @ellyneben993
    @ellyneben993 2 роки тому +1

    How to create a custom camera for video recording which supports different Zoom (1x, 1.5x, 2x etc depending on device) in real time?

    • @rebeloper
      @rebeloper  2 роки тому

      That's a bit hard to do. Let me explain in a mentoring session: rebeloper.com/mentoring

  • @namanvaishnav6193
    @namanvaishnav6193 Рік тому

    how tikTock is using video capture? user has ability to stop/resume recording as well as the main thing delete last fragment of captured recording .. any guidance on that?

    • @rebeloper
      @rebeloper  Рік тому

      For that you'll need a bit more of AVFoundation. Unfortunately I'm not that fluent in that. :(
      Question: Is MVVM Good for SwiftUI? 👇
      ua-cam.com/video/LHMUIc7jq_w/v-deo.html

  • @LeonFrommberger
    @LeonFrommberger 2 роки тому

    Great Video! I want to use a captured image as a overlay for the next image but I can't align them properly.. Do you know how I can solve it?

    • @rebeloper
      @rebeloper  2 роки тому

      I can help you in a mentoring session: rebeloper.com/mentoring
      BTW did you know that now you can Instantly Make BETTER Looking Prototypes in SwiftUI (and UIKit) 👉 ua-cam.com/video/5JO1228HUJE/v-deo.html

    • @ameliafleetwood2989
      @ameliafleetwood2989 Рік тому

      did you ever figure this out? I am having the same issue!

  • @jimouris
    @jimouris Рік тому +1

    Thanks for the video, it was very useful. I am developing an app and I also want to gather accelerometer data using CMMotionManager. Now what happens is that if I take a picture without enabling the CMMotionManager, the picture is saved properly. However, if I first start gathering accelerometer data and then take a picture, the picture is not saved. I'm very new to app dev and to Swift so I might be missing something very obvious, but any ideas on why that happens?

    • @rebeloper
      @rebeloper  Рік тому

      To properly answer your question I would need to take a look at your code. You can book a mentoring session with me here: rebeloper.com/mentoring
      Next watch what's new in SFSymbols 5 👉 ua-cam.com/video/rb6Sgvf6PmE/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @tmasingale
    @tmasingale Рік тому

    Any chance you could direct link the videos you mention on Result type and ViewControllers and any other mentions in the about section. You have several different videos that pop-up when those terms are searched on your channel. -- thanks, great resource btw.

    • @rebeloper
      @rebeloper  Рік тому

      Watch the latest ones. I like to update myself.
      Next Learn FizzBuzz: One Simple Interview Question 👇
      ua-cam.com/video/at5NQdCGxyc/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @maxxon2060
    @maxxon2060 2 роки тому

    This was awesome. Thanks!

    • @rebeloper
      @rebeloper  2 роки тому +1

      Glad you enjoyed it! If you enjoyed this video you will love Animated Splash Screen iOS: ua-cam.com/video/mMl6t6gpB1o/v-deo.html

    • @maxxon2060
      @maxxon2060 2 роки тому

      @@rebeloper Thank you! I'm checking this out now.

    • @rebeloper
      @rebeloper  2 роки тому +1

      Good to hear. BTW if you enjoyed this tutorial make sure you take a look at my latest video about Progress Indicator Examples: ua-cam.com/video/nHr2hh-KgTk/v-deo.html

    • @maxxon2060
      @maxxon2060 2 роки тому

      @@rebeloper Thank you very much. Great content. I really appreciate it.

  • @syedfarazulhaq2765
    @syedfarazulhaq2765 2 роки тому

    Can you please tell me how can I switch the camera the view from back to front?

    • @rebeloper
      @rebeloper  2 роки тому +1

      That's a bit hard. Consider booking a call: rebeloper.com/mentoring
      BTW check out REALM: What is it and why should I use it? 👉 ua-cam.com/video/lck0y1kZxww/v-deo.html

  • @victorriurean
    @victorriurean Рік тому +2

    If you need to use it in multiple views you need to reset the output. Change output from let to var and add this at line 51:
    if !session.canAddOutput(output) {
    session.removeOutput(output)
    output = AVCapturePhotoOutput()
    }

    • @rebeloper
      @rebeloper  Рік тому

      Thanks for the solution.
      Next Learn FizzBuzz: One Simple Interview Question 👇
      ua-cam.com/video/at5NQdCGxyc/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @emilskoglund9795
    @emilskoglund9795 2 роки тому

    Does this code work in macOS as well? If not is there a way to make it work? Great video btw!

    • @rebeloper
      @rebeloper  2 роки тому

      Unfortunately no. BTW Check out WWDC22 Day 2: What's cooking in SwiftUI 👉 ua-cam.com/video/WzAtieE0dbE/v-deo.html

  • @obaticssoftware7377
    @obaticssoftware7377 11 місяців тому

    Unfortunately, I must have created an incorrect project type as much of the UI didn't match. Maybe adding the couple of seconds at the start to show this would have allowed me to continue or maybe a year later Xcode has changed too much to match this tutorial

    • @rebeloper
      @rebeloper  11 місяців тому

      Yes, it's a quite old project. Things change so fast with Xcode. Next check out SwiftUI Navigation Perfected: Harnessing NStack's Game-changing Capabilities 👇
      ua-cam.com/video/nrtr14iOj0E/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @SirWiggs
    @SirWiggs 9 місяців тому

    Hello, how would you add a method to record videos?

    • @rebeloper
      @rebeloper  8 місяців тому

      That is way harder for a comment or a video actually...
      Next watch the new Map in SwiftUI 👇
      ua-cam.com/video/4hLEKVTSjVk/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @brandonsheehan8950
    @brandonsheehan8950 Рік тому

    This works for me fine as an app by itself but once I put it into my bigger app it crashes once you take the picture. I'm getting an error where delegate in the capturePhoto function is unexpectedly nil. Any idea on why this would be the case? It does work about 10% of the time.

    • @rebeloper
      @rebeloper  Рік тому

      I heard that it crashes on iPhone 11 sometimes. Are you using an iPhone 11?
      Next you might want to downgrade from iOS17 beta to iOS16: ua-cam.com/video/fhPNYEOGamo/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

    • @yoavking1999
      @yoavking1999 9 місяців тому

      I am facing the same issue. Any solution to this? Using iPhone 12 with iOS 17.

  • @user-gz3vv3me7u
    @user-gz3vv3me7u 5 місяців тому

    Hii sir i also create a camera app in that app i try to add a portrait effect mode like real camera app i can't do this..help me sir

    • @rebeloper
      @rebeloper  5 місяців тому

      You can book a mentoring session with me and I can take a look at your project: rebeloper.com/mentoring
      Next watch OpenAI Images In SwiftUI Project With Amazing GitHub Repository 👇
      ua-cam.com/video/KN8Ls7oKqd0/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @Nunny25
    @Nunny25 2 роки тому

    Hi, thanks for tutorial, but i does not work for me.. after taking picture there is an error in function capturePhoto - no active and enabled video connection. Any idea what is wrong? Thanks

    • @rebeloper
      @rebeloper  2 роки тому

      Hmm. I don't really know...
      BTW check out REALM: What is it and why should I use it? 👉 ua-cam.com/video/lck0y1kZxww/v-deo.html

    • @sgalanb
      @sgalanb 10 місяців тому

      Same here. To fix it replace *"let output = AVCapturePhotoOutput()"* with the type *"var output: AVCapturePhotoOutput?"* and add *"let output = AVCapturePhotoOutput()"* under *"let session = AVCaptureSession()"* (inside the setupCamera function). Also add *"self.output = output"* under *"self.session = session"*. The problem was that a new output wasn't being generated after photo capture.

  • @anmac6910
    @anmac6910 5 місяців тому

    is AVcam the same thing as ios camera app ? does it have the same exif data ? also, how can I make a custom camera with a watermark in a custom format to overlay on each photo or video ?

    • @rebeloper
      @rebeloper  4 місяці тому

      So much to cover in one comment. Let's see how I can help you in a 1:1 mentoring session: rebeloper.com/mentoring
      Next check out SwiftUI Coordinator Pattern: Everything You Need to Know 👇
      ua-cam.com/video/sikBA9n5H2k/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

    • @anmac6910
      @anmac6910 4 місяці тому

      @@rebeloper what us this ?

  • @sermedix
    @sermedix 2 роки тому

    After taking the photo and dismiss the view, the green LED of the camera remains on. How can i solve?
    Thanks for your work.

    • @sermedix
      @sermedix 2 роки тому

      Resolve: I added parent.cameraService.session?.stopRunning() in photoOutput function... is correct?

    • @rebeloper
      @rebeloper  2 роки тому +1

      That is correct. BTW if you did like this video I think you will enjoy "How to Publish an App to the App Store": ua-cam.com/video/ykiD5wqwSe4/v-deo.html

  • @MohdKashif-ls7wc
    @MohdKashif-ls7wc Рік тому

    i follwed the tutorial and camera was working fine but suddenly it is my app crashes when i click on capturing photo because i am forcing unwrap a optional value which is delegate in capturePhoto function { output.capturePhoto(with: settings, delegate: delegate!)}

    • @rebeloper
      @rebeloper  11 місяців тому

      This video is quite old by now. If you want to I can take a look at your code on a mentoring session: rebeloper.com/mentoring
      Next check out the World's Shortest SwiftUI Course 👉 ua-cam.com/video/zJo6KbeM9Jk/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

    • @roshkaalex
      @roshkaalex 7 місяців тому

      Did you find solution how to fix?

  • @Cdswjp
    @Cdswjp 2 роки тому

    hey my friend; been a while since I had a chance to come across one of your videos. hope you are well!

    • @rebeloper
      @rebeloper  2 роки тому

      Thanks for the visit. I'm doing great. BTW Check out WWDC22 Day 2: What's cooking in SwiftUI 👉 ua-cam.com/video/WzAtieE0dbE/v-deo.html

    • @Cdswjp
      @Cdswjp 2 роки тому

      ​@@rebeloper Ah yes of course, early June has arrived indeed; hence, WWDC. Glad to hear you are good my friend! Will check it out as soon as I get a chance. Cheers!

    • @rebeloper
      @rebeloper  2 роки тому

      Nice! BTW check out REALM: What is it and why should I use it? 👉 ua-cam.com/video/lck0y1kZxww/v-deo.html It's my lates video on the channel.

  • @frankyb702
    @frankyb702 2 роки тому

    Will this support center stage??? Camera tracking?

    • @rebeloper
      @rebeloper  2 роки тому

      Nope, that is part of the FaceTime app. Next check out the FUTURE of SwiftUI Navigation View: ua-cam.com/video/pGqoV31qtsA/v-deo.html

  • @nachiketdesai
    @nachiketdesai 9 місяців тому

    Great video. for me the camera view comes up black with no video. Any idea?

    • @rebeloper
      @rebeloper  9 місяців тому

      Have you set up the Info.plist file?
      How are you testing your projects? Is it TestFlight? How to use TestFlight - Full Guide 👇
      ua-cam.com/video/cdUVbpT-Vks/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

    • @nachiketdesai
      @nachiketdesai 9 місяців тому

      @@rebeloper I am running the app on my phone directly. not using TestFlight
      Yes, I have setup the info.plist file

    • @rebeloper
      @rebeloper  9 місяців тому

      Hmm... I don't really know what could be going wrong. I can take a look at your code if you want to. Book a mentoring session here: rebeloper.com/mentoring
      Next watch The Secret Tool Every Designer and Coder Needs: Design Overlay Collaboration Explained 👉 ua-cam.com/video/mvQf7pDQOps/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @amjadali9986
    @amjadali9986 Рік тому

    Any Idea about creating own Camera SPM?

    • @rebeloper
      @rebeloper  Рік тому

      No yet.
      Next Unlock the Power of Markdown in SwiftUI with THIS Hack! 👇
      ua-cam.com/video/gVy06iJQFWQ/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @adam.alexandru
    @adam.alexandru Рік тому +1

    I just hate AVFoundation. 😢
    I want to get the 60fps video preview in an app. Exactly like in the default camera app, but it does not work. Limited to 30fps.
    And also I have tryed everything to add any visual effect. Nothing, no color grading, contrast, saturation, nothing worked (talking about the filters) the only thing I managed to control is the lens, iso and exposure time… 😢

    • @rebeloper
      @rebeloper  Рік тому

      Yes, AVFoundation is quite hard.
      Next check out WWDC23: You're NOT Ready for this WWDC23 Wish List! 👇
      ua-cam.com/video/msjk6CJpcY8/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @ThomasDevOnline
    @ThomasDevOnline Рік тому

    Can you do this for MacOS? :)

    • @rebeloper
      @rebeloper  Рік тому

      I haven't tested, but it should work.
      Next learn about @Observable @Bindable in iOS17 - SwiftUI Data Flow 👇
      ua-cam.com/video/Igblg7c2T1o/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @VictorRiurean-ee7fj
    @VictorRiurean-ee7fj Рік тому

    nice

    • @rebeloper
      @rebeloper  Рік тому

      Thanks. Next watch How Xcode 15's 6 Preview Features Will Revolutionize Your Development 👇
      ua-cam.com/video/m07mlq2v6Vs/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @mEtAlMaNiAc787
    @mEtAlMaNiAc787 Рік тому

    swift ui > uikit.

    • @rebeloper
      @rebeloper  Рік тому

      Totally agree. Next check out SwiftUI Navigation for Dummies 👇
      ua-cam.com/video/DugBVFJ9jRI/v-deo.html&ab_channel=Rebeloper-RebelDeveloper