<?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 Natan Manik on Medium]]></title>
        <description><![CDATA[Stories by Natan Manik on Medium]]></description>
        <link>https://medium.com/@chris.manikjr?source=rss-e37cd46d8bf2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yemz1qj-do27Nj3FLXb65Q.jpeg</url>
            <title>Stories by Natan Manik on Medium</title>
            <link>https://medium.com/@chris.manikjr?source=rss-e37cd46d8bf2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 06:10:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chris.manikjr/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[Create Animation Using Lottie and SwiftUI]]></title>
            <link>https://medium.com/@chris.manikjr/create-animation-using-lottie-and-swiftui-7ae2c1ce0da8?source=rss-e37cd46d8bf2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ae2c1ce0da8</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[lottie]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Natan Manik]]></dc:creator>
            <pubDate>Wed, 30 Nov 2022 09:32:52 GMT</pubDate>
            <atom:updated>2022-11-30T09:43:02.161Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, I wanna share how to create animation using Lottie and SwiftUI in our app called Seeds — Sexuality Education for Kids</p><p>Seeds is an application to help struggling parents teach their children (aged 7–9 years old) regarding sex education topics. Seeds provide sexuality education by using storytelling methods with interactive illustration animation, games, assessment, and narrative audio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x4Qp0ZM4iDjWUwYkYw7WcA.png" /></figure><blockquote><em>Lottie is a mobile library for Android and iOS that natively renders vector based animations and art in realtime with minimal code. </em><a href="https://lottiefiles.com/">https://lottiefiles.com</a></blockquote><p>If this is the very first time you heard of Lottie, <a href="https://github.com/airbnb/lottie-ios">Lottie</a> is an iOS, macOS, Android, and React Native library, developed by Airbnb, that renders After Effects animations in any native app. Animations are exported as JSON files through an open-source After Effects extension called <a href="https://github.com/bodymovin/bodymovin">Bodymovin</a>. Lottie loads the animation data in JSON format and renders the animation in real-time.</p><p>Let’s start by opening Xcode and creating a new iOS project.</p><ol><li>Open Xcode, select “Create new Xcode project”</li><li>Select iOS, then “Single View App”</li><li>Add the name of the project, organization and identifier. Select <strong>Swift</strong> and <strong>SwiftUI</strong>. Tap <strong>Next</strong> and <strong>Create</strong>.</li><li>Go to terminal, go your project location</li><li>Type pod init</li><li>Open Podfile</li><li>Add pod ‘lottie-ios’ and save and close Podfile</li><li>Run pod install on terminal</li><li>Open your project with .xcworkspace</li><li>Drag the Lottie file (JSON file)to the project navigator</li></ol><p><strong>Lottie library doesn’t support SwiftUI natively</strong>, we need to wrap its UIKit view with the UIViewRepresentable protocol to make it work in SwiftUI projects.</p><p>Now head back to your Xcode project and create a new file using the <em>Swift file</em> template. Name the file ContentAnimation.swift and update its content like this:</p><pre>import SwiftUI<br>import Lottie<br><br>struct ContentAnimationView: UIViewRepresentable {<br>    <br>    let lottieFile: String<br>     <br>    let animationView = AnimatedButton()<br>     <br>    func makeUIView(context: Context) -&gt; some UIView {<br>        let view = UIView(frame: .zero)<br> <br>        animationView.animation = Animation.named(lottieFile)<br>        animationView.contentMode = .scaleAspectFit<br>        <br>        view.addSubview(animationView)<br>        <br>        animationView.clipsToBounds = false<br>           /// Set animation play ranges for touch states<br>        animationView.setPlayRange(fromMarker: &quot;touchDownStart&quot;, toMarker: &quot;touchDownEnd&quot;, event: .touchUpInside)<br>        animationView.setPlayRange(fromMarker: &quot;touchDownEnd&quot;, toMarker: &quot;touchUpCancel&quot;, event: .touchUpOutside)<br>        animationView.setPlayRange(fromMarker: &quot;touchDownEnd&quot;, toMarker: &quot;touchUpEnd&quot;, event: .touchUpInside)<br>             <br>        <br>        animationView.translatesAutoresizingMaskIntoConstraints = false<br>        animationView.widthAnchor.constraint(equalTo: view.widthAnchor).isActive = true<br>        animationView.heightAnchor.constraint(equalTo: view.heightAnchor).isActive = true<br> <br>        return view<br>    }<br> <br>    func updateUIView(_ uiView: UIViewType, context: Context) {<br> <br>    }<br>    <br>}</pre><p>To play the animation, we call the play method of the animation view. The rest of the code is for configuring the layout constraints of the view.</p><p>Now let’s head back to ContentView.swift to use the ContentAnimationView. In the body part, insert the following lines of code:</p><pre>ContentAnimationView(lottieFile: K.StoryTelling.masakScene1)<br>                            .frame(width: (K.widthDf*0.44), height: (K.heightDf*0.63))</pre><p>Perfect, Run your project.</p><p>This is a preview my application using Lottie File</p><p><a href="https://drive.google.com/file/d/1LUCNwSow54QTE20UhOcCUlD7mtU8xvmm/view?usp=share_link">https://drive.google.com/file/d/1LUCNwSow54QTE20UhOcCUlD7mtU8xvmm/view?usp=share_link</a></p><p>The SwiftUI framework already makes it easy to create amazing view animations. With the Lottie library, it’s even easier to incorporate beautiful animations in your apps. I hope you find this tutorial helpful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ae2c1ce0da8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sign In With Apple in SwiftUI (With Example of Implementation on My Own Project)]]></title>
            <link>https://medium.com/@chris.manikjr/sign-in-with-apple-in-swiftui-with-example-of-implementation-on-my-own-project-88c874844093?source=rss-e37cd46d8bf2------2</link>
            <guid isPermaLink="false">https://medium.com/p/88c874844093</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[iphone]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Natan Manik]]></dc:creator>
            <pubDate>Wed, 03 Aug 2022 17:56:21 GMT</pubDate>
            <atom:updated>2022-08-03T17:56:21.919Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*uEeCzW-5pLKb5NoErfK9Wg.png" /></figure><p>Apple introduced a Sign in With Apple in WWDC 2019. Sign in with Apple makes it easy for users to sign in to your apps and websites using their Apple ID. Instead of filling out forms, verifying email addresses, and choosing new passwords, they can use Sign in with Apple to set up an account and start using your app right away. All accounts are protected with two-factor authentication for superior security, and Apple won’t track users’ activity in your app or website.</p><p>For that, I will explain it through the implementation that I’ve done on my project.</p><blockquote>Must have a paid Apple Developer membership and an iOS 13 or later device to implement this tutorial. For running app must used actual device, simulator does not always work properly.</blockquote><p><strong>About My Project (GoFiv)</strong></p><p><strong>GoFiv</strong> is an iOS app that helps learners improve their learning, track their learning progress to achieve their goals, stay productive to reach their goals, remind them to learn, clean and minimalist focus timer, and practice what they learned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tyE5W2usE9QbizPwQlItCg.png" /></figure><h3><strong>Implementation Sign in With Apple in My Project</strong></h3><p><strong>Add Capability<br></strong>First I add Sign In with Apple capability to my provisioning profile. <br>Click the project in the Project navigator, select the <strong>SignInWithApple</strong> target and then click the <strong>Signing &amp; Capabilities</strong> tab. Finally, click <strong>+ Capability</strong> and add the Sign In with Apple capability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R0PnW7VfUbiUGY0_a_-1Mw.png" /></figure><p><strong>Add Sign In Button<br></strong>Apple does not provide a SwiftUI View for the Sign In with Apple button. So I created a SwiftUI file with provided User Interface template and name it SignInWithApple.swift</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6AOuzYAw__gX_zUCMdj6iw.png" /></figure><ol><li>Inherit <strong>UIViewReprenstable</strong> when need to wrap a <strong>UIView</strong></li><li>I add the environment variable <strong>colorScheme.</strong> A property wrapper that reads a value from a view’s environment.</li><li>Function <strong>makeUIView</strong> should always return a specific type of <strong>UIView</strong></li><li>I’m performing customizing the button color, and text to suit. I set button style color to support the light and dark mode with <strong>colorScheme</strong><br><strong>return ASAuthorizationAppleIDButton(type: .signIn, style: colorScheme == .dark ? .white : .black)</strong></li><li>Because the view’s state never changes, I leave an empty implementation in <strong>updateUIView.</strong></li></ol><p>After that, I can add the button to SwiftUI, open <strong>LoginView.swift,</strong> add it to LoginView, and set the frame</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*UlgENtmedzFhe5N-3AeiKA.png" /></figure><p><strong>Handle Show Button</strong></p><p>For now, tapping button will not show anything. I create <strong>showAppleLogin()</strong> after the body property to show authorization dialog:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-swAxigixl_C01_JQpxf9w.png" /></figure><p>After that, I create a gesture recognizer below set frame in SignInWithApple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ZL1JfHnXHTVLVdvXAy0WA.png" /></figure><p>After tapping button will be displaying the authorization dialog on the screen and the latter handles the authorization result based on the user’s action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*eM353FGYRDmfSJdHgUmI7g.png" /></figure><p><strong>Handling User Credential</strong></p><p>After authenticating, the application must handle the authorization result based on the user’s action. I create a new Swift file and name it <strong>SignAppleViewModel.swift</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q0N67brmV1dlt34VaMIHbQ.png" /></figure><p>To handle<strong> failure and error:<br></strong>authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error)</p><p>When authorization is <strong>successful</strong>, <em>authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization)</em> will be called and gives an <strong><em>ASAuthorization</em></strong> object that has a property called <strong><em>credential.</em></strong></p><p>To check <strong><em>credential </em></strong>property, I determine whether the user authenticated via Apple ID (<strong>ASAuthorizationAppleIDCredential</strong>) or a stored iCloud password (<strong>ASPasswordCredential</strong>)</p><blockquote><strong>Apple will only provide the requested details on the <em>first</em> authentication</strong></blockquote><p>Must Remember! Apple assumes that stores the details asked for and thus does not require them again. This is one of the quirks of Sign In with Apple that you need to handle.</p><p>When a user is signing in for the first time, so needs to perform registration. Apple hands the user’s email and full name. I create a function <strong>createNewAccount </strong>to handle it.</p><p>When the user has ever been Signed in, Apple won’t provide the details because it expects already possess them. This causes the “existing user” flow to run, resulting in failure. I create a function <strong>signInWithExitingAccount </strong>to handle it.</p><p>In function <strong>createNewAccount</strong> and <strong>signInWithExitingAccount, </strong>can pass the email, user full name, user identity provided by Apple, and other details to the Backend or Keychain</p><h3>Conclusion</h3><p>Sign in with Apple offers a convenient and private alternative to password-based authentication. Apple has a strong two-factor authentication that’s already used to protect their Apple ID. It provides a trusted device and strong biometrics. For a user signed in to their Apple ID, signing into your app is as easy as a quick face ID or touch ID check. Implementing this will help us to get our users signed in to our application quickly and securely.</p><p>To find out more about Sign In With Apple, you can go to the following Apple Developer Documentation:</p><p><a href="https://developer.apple.com/documentation/authenticationservices/implementing_user_authentication_with_sign_in_with_apple">Implementing User Authentication with Sign in with Apple | Apple Developer Documentation</a></p><p>I hope this article can be useful for the readers and if so, please help to share this post with your friends or colleagues who may also find it useful for them. Thank You.</p><p>© 2022 Chrismanto Natanail Manik. All Rights Reserved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88c874844093" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>