<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Erika Frison on Medium]]></title>
        <description><![CDATA[Stories by Erika Frison on Medium]]></description>
        <link>https://medium.com/@enfrison?source=rss-8c15fde86843------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VWCh6J3jMEBREFFb</url>
            <title>Stories by Erika Frison on Medium</title>
            <link>https://medium.com/@enfrison?source=rss-8c15fde86843------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:12:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@enfrison/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Lights, Camera, Action]]></title>
            <link>https://medium.com/@enfrison/lights-camera-action-b0d996600387?source=rss-8c15fde86843------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0d996600387</guid>
            <dc:creator><![CDATA[Erika Frison]]></dc:creator>
            <pubDate>Thu, 16 Dec 2021 17:06:43 GMT</pubDate>
            <atom:updated>2021-12-16T17:07:38.177Z</atom:updated>
            <content:encoded><![CDATA[<h4>Importing Photos with SwiftUI</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*7U1fUnDJoeXRLgJE2gPZDw.jpeg" /></figure><p>That exciting moment when you take a cool picture and think, “I can’t wait to make this my profile picture!” Have you ever thought of the process it takes to get that picture from your camera roll onto your favorite social media site? It seems like such a quick process since it’s only a few clicks, but it’s actually pretty complex. Even as a beginner, I was still able to figure out how to implement it in an iOS app. Exciting right?! So I know if I can do it, anyone can.</p><h3>The Breakdown</h3><p>I know that coding can make you feel like you’re either on the top of the world or carrying the weight of the world, no in between. But researching a few questions online definitely helped with the learning process. When trying a new project its nice to break things down into small steps so that I can accomplish my goals one by one. I think that is a good way to learn because it can build confidence other than trying something huge, getting frustrated, and wanting to quit all together. My ultimate goal is to render 3D forms in augmented reality, but when thinking hard about the first steps of rendering I realized I will have to access the camera and photo library. So I broke that down even further to figure out how to access a users photo library using SwiftUI. There were multiple results and articles with different answers, and maybe even different ways to do it, but I found a <a href="https://www.youtube.com/watch?v=V-kSSjh1T74">YouTube</a> tutorial since I am more of a visual and hands on learner. In this YouTube video, Sean Allen went step by step showing how to do it. I was able to play and pause the video and try it on my own so that I can learn as he was teaching which went really well for me.</p><p>There was a lot to learn but I want to tell you about 3 things that I learned during the video. These are just a few lines of codes that can make such a difference in your app:</p><pre><strong>import</strong> SwiftUI</pre><pre>// This is the second profile that allows user to access photo library or camera</pre><pre><strong>struct</strong> PhotoPicker: UIViewControllerRepresentable {</pre><pre>  @Binding <strong>var</strong> avatarImage: UIImage</pre><pre><strong>  func</strong> makeUIViewController(context: Context) -&gt; UIImagePickerController {</pre><pre><strong>     let</strong> picker = UIImagePickerController()</pre><pre>     picker.delegate = context.coordinator</pre><pre>     picker.allowsEditing = <strong>true</strong></pre><pre>     // This allows users to crop and edit the photo they choose</pre><pre>     picker.sourceType = .photoLibrary</pre><pre>     // The source code is used when the user wants to use their      camera or photo library</pre><pre><strong>     return</strong> picker</pre><pre>  }</pre><pre><strong>  func</strong> updateUIViewController(_ uiViewController:  UIImagePickerController, context: Context){ }</pre><pre><strong>  func</strong> makeCoordinator() -&gt; Coordinator {</pre><pre><strong>    return</strong> Coordinator(photoPicker: <strong>self</strong>)</pre><pre>  }</pre><pre><strong>  final</strong> <strong>class</strong> Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate{</pre><pre><strong>    let</strong> photoPicker: PhotoPicker</pre><pre><strong>    init</strong>(photoPicker: PhotoPicker) {</pre><pre><strong>    self</strong>.photoPicker = photoPicker </pre><pre>  }</pre><pre><strong>  func</strong> imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : <strong>Any</strong>]) {</pre><pre><strong>    if</strong> <strong>let</strong> image = info[.editedImage] <strong>as</strong>? UIImage {</pre><pre><strong>    guard</strong> <strong>let</strong> data = image.jpegData(compressionQuality: 0.1), <strong>let</strong> compressedImage = UIImage(data: data) <strong>else</strong> {</pre><pre>    //show error or alert</pre><pre><strong>    return</strong></pre><pre>  }</pre><pre>    photoPicker.avatarImage = compressedImage</pre><pre>  } <strong>else</strong>{</pre><pre>    // return an error show an alert</pre><pre>  }</pre><pre>    picker.dismiss(animated: <strong>true</strong>)</pre><pre>       }</pre><pre>    }</pre><pre> }</pre><h3>Lines of Code</h3><pre>picker.allowsEditing = <strong>true</strong></pre><p>This allows a user to edit the image that they choose and pick a section that they want from the picture. For example, if your picture is big and you only want to choose the middle section of the entire photo, it allows you to zoom in on the part of the photo you want.</p><pre>picker.sourceType = .photoLibrary</pre><p>This code allows you to access the users photo library and will allow them to choose a photo of their own.</p><pre>picker.sourceType = .camera</pre><p>This will allow the user to take a picture that’s not in their gallery. But you will have to ask the user for access to their camera before it allows them to take a picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/155/1*GEvFxo_uH1FAmUafnJQ1eg.gif" /><figcaption>Example of user accessing photo library</figcaption></figure><h3>Appreciation</h3><p>These examples are pretty minor compared to the entire project but it was very interesting to me how something as small as “allowsEditing” can make such a huge impact on your app. It really gives the user control of their own image. Also, the seemingly simple change of .sourceType will allow the user to choose photos from their library OR take a new photo. I think those are great options for an app. They can really help the user feel like they have control of what they do and show on your app.</p><p>I know that I am pretty far from learning how to do rendering but I feel empowered learning new things, accomplishing goals, and being able to understand some of this coding language. My ultimate goal is to learn how to do 3D/2D Rendering on Xcode with <a href="https://developer.apple.com/augmented-reality/">ARKit</a>. I will continue to document what I’m learning on Xcode and appreciate all the current apps in the world that allow us to see how small one item on their project can make such a huge difference for the user. In the meantime, I will enjoy my success for my profile picture app and practice coding just as someone may practice posing for the camera to update their profile picture. Lights, Camera, Action!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0d996600387" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>