<?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 Lê Tấn Thành on Medium]]></title>
        <description><![CDATA[Stories by Lê Tấn Thành on Medium]]></description>
        <link>https://medium.com/@thanhlt36-ios?source=rss-e3a4c545e206------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Tn7HcKGP2G2yu773.</url>
            <title>Stories by Lê Tấn Thành on Medium</title>
            <link>https://medium.com/@thanhlt36-ios?source=rss-e3a4c545e206------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 05:29:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thanhlt36-ios/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[Introduce Accessibility Inspector in Xcode?]]></title>
            <link>https://thanhlt36-ios.medium.com/introduce-accessibility-inspector-in-xcode-a5a65e668970?source=rss-e3a4c545e206------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5a65e668970</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Lê Tấn Thành]]></dc:creator>
            <pubDate>Tue, 05 Jul 2022 13:40:34 GMT</pubDate>
            <atom:updated>2022-07-05T13:40:34.445Z</atom:updated>
            <content:encoded><![CDATA[<p>XCode provides a tool to debug the Accessibility feature. In the list of <strong>Open Developer Tools</strong>, you can find <strong>Accessibility Inspector</strong>. There are features</p><ul><li>Runs and checks common accessibility issues</li><li>Check detail accessibility attributes of elements</li><li>Finding weaknesses is time-consuming and error-prone</li></ul><p>Developer can open from <strong>XCode</strong> → <strong>Open Developer Tools</strong> → <strong>Accessibility Inspector</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rTsXd0sbNyJm34IbEQAevQ.png" /><figcaption>How to open tool Accessibility Inspector</figcaption></figure><p>The tool will provide components</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTin8RmjhucMOsEesZHfvA.png" /></figure><h3><strong>1. Target chooser</strong>:</h3><p>You can select your MAC, simulator, or your devices. When you select one of the items, the tool will inspect it to help you debug information and simulate states</p><h3><strong>2. Inspector Tab</strong></h3><p>The option shows info on the accessibility element</p><ul><li><strong>Target an item: </strong>This button allows you to enable/disable to display information about</li><li><strong>Navigation</strong> In the navigation view, we also controller to switch between elements by <strong>left/right arrow icons</strong>. You also turn on/off speak description elements such as Voice Over by the <strong>common icon</strong>. If you want to be run around all elements on-screen automatically, begin leading top and finish at the trailing bottom, you just click the <strong>play icon</strong></li><li><strong>Basic: </strong>The section will show properties of accessible element</li><li><strong>Action: </strong>Show action available on elements, including the button “Perform&quot; so you can execute immediately. This action was declared in property <strong>accessibilityAction</strong>.</li><li><strong>Element: </strong>Show kind of class, address on memory, controller of element</li><li><strong>Hierarchy: </strong>Show the view hierarchy for the element.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*rcz0V6tpWpltDgk1q69wKA.png" /></figure><h3>3. <strong>Audit Tab:</strong></h3><p>Tab just only has one Button “Run Audit&quot;, and the option allows you select information in logs. By clicking the button “Run Audit”, you can get a list of potential accessibility issues</p><p>If you select an item, the bottom will show the UI element, and extend the item to get more detail</p><ul><li>Eye icon: To display the item include rounded on the screen</li><li>Question mark icon: To show fix suggestions for the issue</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BdyJOkG1iCgQ7t2sDl5FZw.png" /></figure><h3>4. <strong>Settings Tab:</strong></h3><p>There are common accessibility options to test an App</p><ul><li>Invest Color: Enable mode inverting colors is often used to help users with light or color sensitivities to make bright colors darker</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*UTD1eajcrEZ0RYZ_dxY1zw.png" /></figure><ul><li><strong>Increase Contrast</strong> enable/disable accessibility feature available in iOS that allows users to increase the contrast of all text and controls across their entire device</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*NoD-eEFXEK-HDGWCSppMIQ.png" /></figure><ul><li>Reduce Transparency: Improve contrast and reduce blur on some backgrounds to increase legibility</li><li>Reduce motion: Reduce the motion of the user interface, including the parallax effect of icons and alerts.</li><li><strong>Bold fonts:</strong> Set all font weights are bold</li><li><strong>On/Off labels</strong>: The ‘On/Off Labels’ feature adds a ‘0’ (zero) to the toggle switch when it is off and a ‘1’ (one) when it is on. This can make it easier for anyone who may have difficulty distinguishing between the two based on color alone.</li><li><strong>Button Shapes:</strong> Add effect, and style to help user can detect buttons</li><li><strong>Grayscale</strong></li><li><strong>Differentiate without color</strong>: intended to be helpful for users with visual difficulties or color blindness, and it aims to use shapes to relay information rather than colors. Example</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/0*mfWS0SVa6nZDevwx.jpg" /></figure><ul><li><strong>Dynamic type</strong>: change the size font of the text in the app</li></ul><p>Reference :</p><ul><li><a href="https://developer.apple.com/documentation/accessibility">Accessibility | Apple Developer Documentation</a></li><li><a href="https://www.raywenderlich.com/6827616-ios-accessibility-getting-started">iOS Accessibility: Getting Started</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5a65e668970" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything about Dark Mode in iOS Programing]]></title>
            <link>https://thanhlt36-ios.medium.com/everything-about-dark-mode-in-ios-programing-6219bc5be902?source=rss-e3a4c545e206------2</link>
            <guid isPermaLink="false">https://medium.com/p/6219bc5be902</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[dark-mode]]></category>
            <dc:creator><![CDATA[Lê Tấn Thành]]></dc:creator>
            <pubDate>Tue, 21 Jun 2022 08:15:10 GMT</pubDate>
            <atom:updated>2022-06-21T08:15:10.183Z</atom:updated>
            <content:encoded><![CDATA[<p>Since iOS 13, Apple has enabled Dark Mode to the user interface for devices running on iOS and iPadOS, also supporting abilities and tools to develop and switch Dark and Light Mode easily.</p><p>The points mentioned in the article are</p><ul><li>Support testing UI on dark mode.</li><li>Colors</li><li>Assets</li><li>SFSymbols</li><li>Opting out the dark mode</li></ul><h3>Support testing UI on dark mode</h3><p>In XCode, Apple provides a button to switch light and dark appearance on the storyboard when developing design UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ESIxuiy11UjXKG2ZZZikw.png" /><figcaption>Switch Dark and Light mode when designing on storyboard</figcaption></figure><p>When you run your app via Xcode, a set of debugging buttons appears at the bottom. Click the <strong><em>Environment Overrides</em></strong> button and a pop-up will appear. There’s an <strong><em>Interface Style</em></strong> toggle at the top of the pop-up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*HrhWFDqyyDcbegJCVZoPKg.png" /><figcaption>Switch Dark and Light Mode when debugging</figcaption></figure><blockquote><em>Instead of using the </em><strong><em>Environment Overrides</em></strong><em>, we can use a hotkeys </em><em>Command + </em><em>Shift + </em><em>A to switch modes</em></blockquote><h3>Colors</h3><p>If you make it difficult when working with color and choose compatibility one for the app. Fortunately, Apple provides type colors based purpose and layouts of UI, colors will can read and adapt better for both modes.</p><h3>System Color</h3><p>Apple supports a palette of colors prefixed with a word system which colors provide suitable and legible shades on both light and dark backgrounds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xX8J0V_XuwG8SADLAIutSA.png" /><figcaption>Palette system color of Apple</figcaption></figure><p>Example code</p><pre>// let textColor = UIColor.red<br>// Use .systemRed instead of .red<br>let textColor = UIColor.systemRed</pre><h3>Semantic Color</h3><p>Semantic colors provided based semantically defined colors, depends on their purpose, and adapt Dark Mode easily. Examples of semantic colors include .label, .separator, .link , .systemBackground, and .systemFill</p><h3>Background Color</h3><p>We will have 2 sets for background colors: system and grouped, and contain primary, secondary, tertiary, and quaternary variants per set. When the app has grouped table view, we prefer to use group colors. About hierarchy of color on the view:</p><ul><li>Primary for the overall view.</li><li>Secondary for grouping content or elements within the overall view.</li><li>Tertiary for grouping content or elements within secondary elements.</li><li>Quaternary for grouping content or elements within tertiary elements.</li></ul><h3>Dynamic Color</h3><h3>Asset Color</h3><p>In case the application is not dependent or limited in design, developer still create item Color in Asset file. After developer set Appearances, you will have more option to set color for modes</p><p>In the above, colors are fixed on Dark and Light modes. In some situations, we need to update the color in running time, so we need use UITraitCollection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k9NFMgJwRM8vAes0a_b9iQ.png" /></figure><h3>UITraitCollection</h3><p>UITraitCollection is one of properties in protocol UITraitEnvironment. This protocol was implemented in UIWindow , UIViewController , UIView</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nl3bo33gzNQNoidmYnoy8Q.png" /></figure><p>Developers can access views and layout to update colors based on the business app, appearance handled under the hood by traitCollection.</p><p>This is way to use traitCollection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DOORZNITwvvzyGeUf7DyqA.png" /></figure><h3>Dynamic Image</h3><p>I shared many thing about color. How can we use dynamic images between Dark and Light modes? The same way add variation to a color, click Appearances and choose Any,Dark . A new empty slot appears, drag image you want show in dark mode and light mode</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JF3WMmnApgPC2Dv0K3sLyg.png" /></figure><h3>SFSymbols</h3><p>SFSymbol was introduced on iOS 13 which is a huge set of consistent and highly configurable images. These symbols scale well based on appearance, size and weight. And best of all, you can also use them in your apps for free.</p><p>SFSymbol already support Dark Mode, Symbols will be adapt beautifully. You can set tintColor with dynamic colors and renderMode by default, follow with this code below:</p><pre>imageView.tintColor = .systemGreen<br>imageView.image?.withRenderingMode(.automatic)</pre><p>Design also create custom symbol, it describe in article <a href="https://developer.apple.com/documentation/uikit/uiimage/creating_custom_symbol_images_for_your_app">https://developer.apple.com/documentation/uikit/uiimage/creating_custom_symbol_images_for_your_app</a></p><h3>Opting out of Dark Mode</h3><p>Although Dark Mode is popular than ever, and almost application already support Dark Mode. However, if your application don’t want apply this feature, you have few ways to opt-out Dark Mode:</p><ol><li>Turn Dark Mode off for the whole app by using the UIUserInterfaceStyle key in <strong><em>Info.plist</em></strong>.</li><li>Set the interface style on the app’s UIWindow, which usually means the whole app.</li><li>Set the interface style for a specific UIView or UIViewController.</li></ol><h3>Turn off by Info.plist</h3><p>In file <strong><em>Info.plist</em></strong> you add new key-value</p><pre>&lt;key&gt;UIUserInterfaceStyle&lt;/key&gt;<br>&lt;string&gt;Light&lt;/string&gt;</pre><p>In some old topic, if you add key-value in format Property List, the name key can <strong><em>User Interface Style</em></strong>, but it changed into <strong><em>Appearance</em></strong> in newest versions.</p><p>After we set this property, your application just adopt only style Light or Dark when app running.</p><h3>UIWindow</h3><p>Another way, developer can set programmatically by get-set on property window in SceneDelegate</p><pre>class SceneDelegate: UIResponder, UIWindowSceneDelegate {<br>    var window: UIWindow? {<br>        didSet {<br>            window?.overrideUserInterfaceStyle = .light // .dark<br>        }<br>    }<br>}</pre><p>If you set both <strong><em>Info.plist</em></strong> and UIWindow, the code on UIWindow will be override config on file <strong><em>Info.plist</em></strong></p><h3>Opting Out in UIViewController</h3><p>In UIViewController you can prevent Dark Mode by insert these code in viewDidLoad()</p><pre>func viewDidLoad() {<br>     super.viewDidLoad()<br>     overrideUserInterfaceStyle = .light<br> }</pre><p>This line overrides the style for this specific view controller, and override all above config in <strong><em>Info.plist</em></strong> or UIWindow</p><h3>Reference</h3><p><a href="https://www.raywenderlich.com/10718147-supporting-dark-mode-adapting-your-app-to-support-dark-mode">https://www.raywenderlich.com/10718147-supporting-dark-mode-adapting-your-app-to-support-dark-mode</a></p><p><a href="https://developer.apple.com/documentation/uikit/uiimage/creating_custom_symbol_images_for_your_app">https://developer.apple.com/documentation/uikit/uiimage/creating_custom_symbol_images_for_your_app</a></p><p><a href="https://www.toptal.com/designers/ui/dark-ui-design">https://www.toptal.com/designers/ui/dark-ui-design</a></p><p><a href="https://sarunw.com/posts/how-to-change-color-of-sf-symbols/">https://sarunw.com/posts/how-to-change-color-of-sf-symbols/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6219bc5be902" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate Apple Sign In in your iOS Application with Swift, React Native and Flutter]]></title>
            <link>https://thanhlt36-ios.medium.com/integrate-apple-sign-in-in-your-ios-application-with-swift-react-native-and-flutter-938d45feb514?source=rss-e3a4c545e206------2</link>
            <guid isPermaLink="false">https://medium.com/p/938d45feb514</guid>
            <dc:creator><![CDATA[Lê Tấn Thành]]></dc:creator>
            <pubDate>Wed, 01 Jul 2020 11:23:48 GMT</pubDate>
            <atom:updated>2020-07-01T11:23:48.538Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, in my <a href="https://medium.com/@ltnthnh_99459/configure-ios-project-supported-login-firebase-server-by-appleid-76a6a2c218e1">previous story</a>, I shared how to configure to allow Apple Sign In with your iOS Application by XCode and through Firebase server. Today, I continue to guide you on how to integrate Apple Sign In in your Application by Swift, React Native and Flutter</p><h3>Prerequisite</h3><ul><li>Have basic knowledge about iOS programming, Swift, Flutter and React Native</li><li>Default, I assume you configured your project to available login by Apple Sign In. If not, don’t worry, you can read <a href="https://medium.com/@ltnthnh_99459/configure-ios-project-supported-login-firebase-server-by-appleid-76a6a2c218e1">my guide</a> before.</li><li>IDE: XCode 11.3.1 or later and target iOS 13.1</li></ul><h3>CocoaPod</h3><p>This is a dependency manager for iOS projects. Almost iOS Developers use CocoaPod to manage dependencies and their libraries, also cross-platform use CocoaPod when generating a native-app ( React-Native and Flutter). So we must install CocoaPod in your macOS by below command line. If you got it, you can skip this step.</p><pre>$ sudo gem install cocoapods</pre><p>CocoaPod uses Podfile to declare implemented libraries into the project. With React Native and Flutter, Podfile was created when you init a new project. But if you create a new iOS Project by XCode, you will init Podfile and setup into your project.</p><h3><strong>Swift</strong></h3><h4>I/ Implement Firebase SDK</h4><p>After you created new project iOS by XCode and set Bundle Identifier which configured in the <a href="https://medium.com/@ltnthnh_99459/configure-ios-project-supported-login-firebase-server-by-appleid-76a6a2c218e1">previous topic</a> (Example my bundle identifier `com.faba.loginappleid`). Please make sure you download the file GoogleService-Info.plist from Firebase and add it to your project.</p><p>At the current project folder, open Terminal and type touch Podfile . Your folder will make a Podfile file. Let’s open it and add some code lines to implement libraries.</p><pre>#Target iOS version to your libraries<br>platform :ios, &#39;9.0&#39;</pre><pre>#Replace &lt;YourTargetHere&gt; by your target in project, default target is name project.<br>target &#39;&lt;YourTargetHere&gt;&#39; do</pre><pre>use_frameworks!<br>  #Firebase SDK to authenticate<br>  pod &#39;Firebase/Auth&#39; <br>end</pre><p>Reopen Terminal and install by command pod install</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*9hM5N7IEKbnnNJJ8GukWag.png" /><figcaption>CocoaPod install Firebase SDK</figcaption></figure><p>It takes a few minutes to install dependencies and it will generate a new file &lt;ProjectName&gt;.xcworkspace that manages app project and pod projects. Your app must be initialized FirebaseSDK when it starts. So in your app delegate (AppDelegate.swift), first import the Firebase SDK:</p><pre>import Firebase</pre><p>Then, in the method application:didFinishLaunchingWithOptions: , initialize the FirebaseApp object:</p><pre>// Use Firebase library to configure APIs<br>FirebaseApp.configure()</pre><h4>II/ Create Login Button</h4><p>Firstly, you must import <a href="https://developer.apple.com/documentation/authenticationservices">AuthenticationServices</a> framework — this is framework support log into app and services by Apple, and create a button login Apple ID. We have two ways to create login Button.</p><ul><li>Use the standard button which was provided by Apple. ASAuthorizationAppleIDButton</li><li>Use the default UIButton</li></ul><p>Both two ways, your button must be inited selector to handle when users click. If users pressed the button, it calls authorization request for user’s full name and email address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*h3x4_U0itLQ9yYk3_xrPMQ.png" /><figcaption>Code selector call authorization request</figcaption></figure><p>But the system will check the user is signed in with their Apple ID on the device. If the user is not signed in at the system-level, the app will present an alert directing user to sign in with their Apple ID in Settings. In the above code, you will set ASAuthorizationControllerDelegate to handle the error or the success of authentication.</p><p>The method authorizationController(controller:didCompleteWithError:) will handle the error, you can add alert or show log error here.</p><p>The method authorizationController(controller:didCompleteWithAuthorization:) will handle complete if you login successfully.</p><h4>III/ Sign In Firebase with Apple ID</h4><p>After login, you can get property identityToken from an object ASAuthorizationAppleIDCredential and use it login with Firebase. In head topic, I guide you to implement Firebase to your project and now this is the reason. In your class please import FirebaseAuth framework. It provides a function to call authorize the request to your Firebase project and need three parameters</p><ul><li>providerID: apple.com</li><li>idToken: value is your identityToken after login by Apple Id</li><li>rawNonce: this is a random string, you should generate for every sign-in request, this important mechanism helps to prevent replay attacks. “Nonce” is meaning for one time, only this time. But I will set value is empty to we can pass quickly for this tutorial</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qWrXmmK6V3SxpGpWo8psA.png" /><figcaption>Code handle to login Firebase by AppleID</figcaption></figure><p>In my example, I will goToMainScreen if the response is a success status from my Firebase project. You can replace other actions according to your business. And if you want to add random nonce you can read more <a href="https://firebase.google.com/docs/auth/ios/apple#sign_in_with_apple_and_authenticate_with_firebase">here</a>. Also, you can use reauthenticate to retrieve a fresh credential for recent sign-in.</p><h3>React Native</h3><h4>I/ Implement Firebase SDK</h4><p>One of the problems of react-native is don’t have official libraries. Although Expo published to resolve this issue but also it still makes difficult when user implements external libraries. If you are using Expo, you can sign in Apple Id with this <a href="https://docs.expo.io/versions/latest/sdk/apple-authentication/"><strong><em>guide</em></strong></a><strong><em>. </em></strong>I will introduce another library and I used it in my project. That is <a href="https://github.com/invertase/react-native-apple-authentication">react-native-apple-authentication</a></p><p>Go to folder project React Native and install with yarn</p><pre>yarn add @invertase/react-native-apple-authentication<br>yarn add @react-native-firebase/app<br>yarn add @react-native-firebase/auth</pre><p>Notice, <a href="https://github.com/invertase/react-native-apple-authentication">react-native-apple-authentication</a> help you sign-in with AppleID, and <a href="https://www.npmjs.com/package/@react-native-firebase/auth">react-native-firebase/auth</a> help you sign-in to Firebase</p><p>Go to folder ios and do command line pod install to install libraries to XCode Project and create workspace link project iOS to Pods libraries project.</p><p>Open AppDelegate.m and insert these codes:</p><pre>#import &lt;Firebase.h&gt;</pre><pre>... //Some other lines</pre><pre>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { </pre><pre>... //Some other lines</pre><pre>  if ([FIRApp defaultApp] == nil) {<br>    [FIRApp configure];<br>  }</pre><pre>... //Some other lines</pre><pre>}<br>... //Some other lines</pre><p>Please remember to configure your XCode Project with the same bundle identifier and add file GoogleService-Info.plist from the Firebase project.</p><h4>II/ Create Login Button</h4><p>Library <a href="https://github.com/invertase/react-native-apple-authentication">react-native-apple-authentication</a> don&#39;t not only provide function API sign in with Apple ID but allow developer can use default component AppleButton which renders the standard UI of Apple Sign In Button easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*JPX6T0Rpl0VAGEusXOgpUw.png" /><figcaption>AppleButton component</figcaption></figure><p>The component supports to set style WHITE or BLACK, onPress is arrow function to you can handle when a user clicked on a button.</p><h4><strong>III/Sign In Firebase with Apple ID</strong></h4><p>In function onClickAppleAuthentication I perform the same request get identifyToken and authorize with Firebase server by JS instead of Swift</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*t9Y4IZPiMD6Nb37FMy9jnw.png" /><figcaption>Call request authorize Apple ID and log in to Firebase</figcaption></figure><p>Firstly, we use appleAuth to call performRequest with scope Email and FullName, it will return Promise&lt;AppleAuthRequestResponse&gt; and we will try-catch here. If a user login success, the response will contain values of identityToken and nonce. These values we use to sign-in to Firebase by function auth.signInWithCredential .</p><p>Remember, you must import these libraries</p><pre>import {AppleButton} from &#39;@invertase/react-native-apple-authentication&#39;;</pre><pre>import auth, {firebase} from &#39;@react-native-firebase/auth&#39;;</pre><pre>import appleAuth, {</pre><pre>AppleAuthRequestScope,</pre><pre>AppleAuthRequestOperation,</pre><pre>} from &#39;@invertase/react-native-apple-authentication&#39;;</pre><p>Check again and make sure you configure correctly, now run simulator and test with your account.</p><h3>FLUTTER</h3><h4>I/ Implement Firebase SDK</h4><p>Flutter is a framework written by Dart language.</p><p>To implement FirebaseSDK and Sign In with Apple, you must add <a href="https://pub.dev/packages/firebase_auth">firebase_auth</a> and <a href="https://pub.dev/packages/firebase_core">firebase_core</a> in the <a href="https://firebaseopensource.com/projects/firebaseextended/flutterfire/">FlutteFire</a>. Open pubspec.yaml in the project folder and add this line code</p><pre>dependencies:<br>  firebase_auth: ^0.16.1<br>  firebase_core: ^0.4.5<br>  sign_in_with_apple: ^2.5.1</pre><p>Save the file and install the library by call command line flutter pub get , if you are using the VS Code, it will automatically install the library after you save the file. To use in your code, please import in top of the file</p><pre>//For sign_in_with_apple library<br>import &#39;package:sign_in_with_apple/sign_in_with_apple.dart&#39;;</pre><pre>//For firebase core<br>import &#39;package:firebase_core/firebase_core.dart&#39;;</pre><pre>//For firebase auth<br>import &#39;package:firebase_auth/firebase_auth.dart&#39;;</pre><h4>II/ Create Login Button</h4><p>In the library sign_in_with_apple , it provides Widget SignInWithAppleButton allow us to create a button that renders the standard UI of Apple Sign In Button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*dv2WvXxgdM2FBv8dBgmJ-A.png" /></figure><h4>III/Sign In Firebase with Apple ID</h4><p>In function _onClickAuthorizeApple , you also do two steps. Step one, you need to authorize with Apple by your Apple ID. firebase_auth provide function API SignInWithAppled.getAppleIdCredential to sign in with Apple ID. You must provide arguments to call request to Apple Server.</p><ul><li>scopes: list authorizationCode</li><li>webAuthenticationOptions: (optional) for Android</li><li>nonce: a random string</li><li>sha256Nonce: sha256 of nonce variable</li><li>state: (optional) data that’s returned after a successful authentication</li></ul><p>After login success, you will receive identityToken and use it for login Firebase. Init OAuthProvider instance with providerId is apple.com and an initial instance of AuthCredential class to call API FirebaseAuth.instance.signInWithCredential . Your response is AuthResult and gets user information from Firebase. flutter run to start simulator and test feature, remember to configure XCode project in ios folder before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*jIWMY2y46oHA0MmgSyf2pA.png" /></figure><h4>Notice: Although document google said nonce is an optional variable, but in the firebase_auth library of flutter, you must input one of the arguments (accessToken and rawNonce) to create custom AuthCredential.</h4><h3>ERROR</h3><ul><li>If you meet error <strong>Authorization failed: Error Domain=AKAuthenticationError Code=-7026.</strong> I think that you forgot to add the capability “Sign In With Apple” in your XCode Project.</li><li><strong>AKAuthenticationError Code=-7003 </strong>input password incorrectly</li><li>Don’t show Google Sign In PopUp, please URL schemes added value of key `REVERSED_CLIENT_ID` from GoogleService-Info.plist file.</li></ul><h3>References</h3><ul><li><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></li><li><a href="https://firebase.google.com/docs/auth/ios/apple">Authenticate Using Apple | Firebase Documentation</a></li></ul><p>Github example :</p><p><a href="https://github.com/fabathanhlt/example_login_appleid">fabathanhlt/example_login_appleid</a></p><p>Thanks for reading my article</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=938d45feb514" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configure iOS project supported login  Firebase server by AppleID.]]></title>
            <link>https://thanhlt36-ios.medium.com/configure-ios-project-supported-login-firebase-server-by-appleid-76a6a2c218e1?source=rss-e3a4c545e206------2</link>
            <guid isPermaLink="false">https://medium.com/p/76a6a2c218e1</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[fabatechnology]]></category>
            <category><![CDATA[apple-sign-in]]></category>
            <dc:creator><![CDATA[Lê Tấn Thành]]></dc:creator>
            <pubDate>Fri, 19 Jun 2020 09:10:40 GMT</pubDate>
            <atom:updated>2020-06-19T09:10:40.092Z</atom:updated>
            <content:encoded><![CDATA[<h3>Configure iOS project supported login Firebase server by AppleID.</h3><p>Since April 2020, Apple has a big change when the required app must contain feature login by AppleID if your app uses social login services such as Facebook, Google, Twitter, etc… So I write this article to help you can implement feature login by AppleID to Firebase server.</p><h3>Notice</h3><p>The article will guide you:</p><ul><li>How to setup Configure Firebase project, Apple Developer, and XCode to prepare sign in Firebase by Apple ID.</li></ul><p>So if you are looking for a guide to implement feature Sign In Apple, it&#39;s not fully and I will be writing in next my story.</p><h3><strong>Configure Firebase Project</strong></h3><p>You must have an account firebase to access and do all things which be described below.</p><p>Go to <a href="https://console.firebase.google.com/">console firebase</a> and login with your account. After that, we will create a new project, below image, I created a new project with name `faba-production`</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*N-j7yB3PO4_RSOob1URB9A.png" /><figcaption>Create new project</figcaption></figure><p>In this project, you can add applications of iOS, Android, Web, Unity platforms. But we just need to register an iOS application. Example, I register app with ID `com.faba.loginappleid`</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jF8qQA4g4B-CQn4G2bwmxw.png" /><figcaption>Step 1. Register your app to firebase</figcaption></figure><h4><strong>RegiterApp:</strong></h4><ul><li><strong><em>iOS bundle ID</em></strong>: that is the bundle ID of your application. If your application is existing, you must fill its bundle ID in this field. Conserve, you create a new bundle ID and must apply this ID to later configuration</li><li><strong><em>App nickname and App Store ID</em></strong>: there are optional fields. You can update later and they don&#39;t affect your project</li></ul><h4>Download Config File</h4><p>From your information, the Firebase system will generate one file configuration `GoogleService-Info.plist`. The file provides information to configure and support the Firebase SDK link from your app iOS to server-side. You will copy the file to the iOS project folder and open XCode to create a reference file with the iOS project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQtmQ4IhRDURbkm52sQ-xg.png" /><figcaption>Download file and link to your XCode project</figcaption></figure><h4>Add Firebase SDK and initialization code</h4><p>Before Firebase SDK can integrate by Carthage or import SDK directly, but with my experience, those ways will make difficult for the developer and take a lot of time. Another reason, projects use static libraries to increase size of their repository. The almost iOS project will use CocoaPod and manage by Podfile, all libraries will install and set up just one command line</p><p>pod install</p><p>Finally, you must implement code to app client call to server-side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZhZE4hThuHrZZKrh9QuKpA.png" /><figcaption>Install Firebase SDK to XCode Project</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s1xS9qoVnW-oUjW-FrArug.png" /><figcaption>Implement code initialize Firebase SDK in your project</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QeLYYD4TFmBBPyWxd1cl6w.png" /><figcaption>The final step to verify your configure</figcaption></figure><p>You should be run project by XCode and wait to Firebase verify configurations that it is correct. If it’s too long time, you can skip step. Sometimes bug occurs because it has a delay, but in the future, if you have a problem when access with Firebase, you need to check this.</p><p>Go back to Firebase console → Authentication → Sign-In Method, scroll down to Apple, set enable and save your modified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c1nLN8fqaM4O-LOvRcGlrQ.png" /><figcaption>Set Enabled for Apple Sign-In</figcaption></figure><h3>Configure Apple Developer</h3><p>Unlike Android, all iOS developers must have an Apple Developer account to work and configure for their project. Because Apple uses `Certificate`, `Identifier`, and `Profile` to defines authors (developers) with their products and services provided by Apple and devices. I will not explain or writing anything about them here. You can read more at <a href="https://docs.getupdraft.com/ios/code-signing-explained-certificates-identifiers-profiles-what">link</a></p><p>Go back to our topic, if you don&#39;t have the identifier with bundle ID same with ID which registered on Firebase ( mine is `com.faba.loginappleid`), you must create a new one. In section <strong>Capabilities</strong>, you set to enable option Sign In with Apple for Enable as a primary App ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t8GBDeBiw72AGJKsXOYEoQ.png" /><figcaption>Set enable Sign In With Apple</figcaption></figure><p>To allow users to set up and sign in to your apps. Go to Certificates, Identifiers &amp; Profiles → More → Configure Button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VDkVQLuDRhg1tflGSy2u8A.png" /></figure><p>You will go to Configure Sign In with the Apple page and saw list email sources. Register your email sources to Apple follow the syntax noreply@YOUR_FIREBASE_PROJECT_ID.firebaseapp.com. Also, add domains of your Firebase project YOUR_FIREBASE_PROJECT_ID.firebaseapp.com . Save to finish the configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*85znoLQntT7zHfxQXjTY5A.png" /></figure><p>Register a new Provisioning Profile both Development and Distribution AdHoc or App Store. Provisioning Profile will verify your App and provider services with author certificates.</p><ul><li>Development Provisioning Profile: to install development apps on test devices.</li><li>AdHoc Provisioning Profile: to install your app on a limited number of registered devices.</li><li>AppStore Provisioning Profile: to submit your app to the App Store.</li></ul><h3>Configure XCode</h3><p>Finally, you must add an important Capability option to your project. That&#39;s is `Sign In With Apple` to synchronize with your configuration on Apple Developer. Remember you must add for all build ( both Debug and Release) and change bundle ID which registered on the head article ( mine is `com.faba.loginappleid`).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6vhKHyRkkDSTaZYpLQm4g.png" /></figure><p>Download provisioning profiles you registered above, and click to open files. Link your project in code signing and provisioning profiles in XCode.</p><h3>P.S</h3><p>Thank you for your reading, I am looking forward to your feedback to improve my later stories.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76a6a2c218e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom font with React Native]]></title>
            <link>https://thanhlt36-ios.medium.com/custom-font-with-react-native-eecf64bc6b88?source=rss-e3a4c545e206------2</link>
            <guid isPermaLink="false">https://medium.com/p/eecf64bc6b88</guid>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[newbee]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Lê Tấn Thành]]></dc:creator>
            <pubDate>Wed, 10 Jun 2020 04:10:23 GMT</pubDate>
            <atom:updated>2020-06-10T04:10:23.452Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, this is my first post about technical. So I want to share basic tips for newbies. That is how to set up custom fonts for iOS and Android applications with React Native.</p><h3><strong>GET CUSTOM FONT NAMING</strong></h3><p>Firstly, we should find and get the family name of the font. We have two ways to get it:</p><p>- Drag and drop to upload your font on the website <a href="https://fontdrop.info/">https://fontdrop.info</a>.</p><p>- Install font and show info of font. For example on macOS, I will open the Font Book App and get font-family from PostScript Name.</p><p>Secondly, to avoid confuse name file and font name, I think that we should change the name file same as its family name.</p><h3><strong>ADD FONT TO ASSETS</strong></h3><p>Download your font and copy to your folder which you want to store font. Example of:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*5sm3fzk6XX3NdEMN.png" /><figcaption>H1. Path custom font</figcaption></figure><p>Add declare path custom font to file package json, In above image, I stored in <em>‘src/assets/fonts’</em></p><pre><em>&quot;rnpm&quot;: {</em></pre><pre><em>  &quot;assets&quot;: [</em></pre><pre><em>    &quot;./src/assets/fonts&quot;</em></pre><pre><em>  ]</em></pre><pre><em>}</em></pre><p>After that call command line on terminal at folder project</p><pre>react-native link</pre><h3><strong>CONFIGURE FONT ON IOS AND ANDROID</strong></h3><p><strong>iOS:</strong></p><ul><li>Open file <em>“./ios/${projectName}/Info.plist”</em> by Source View and implement new key <em>“UIAppFonts”</em> with value is your list custom fonts. Example of:</li></ul><pre><em>&lt;key&gt;UIAppFonts&lt;/key&gt;<br>&lt;array&gt;<br>&lt;string&gt;Metal Mania.ttf&lt;/string&gt;<br></em>&lt;/array&gt;</pre><ul><li>Copy custom font to folder ios by command line.</li></ul><pre><em>mkdir -p ios/assets/fonts | cp src/assets/fonts/* ios/news/fonts</em></pre><ul><li>Open file <em>${projectName}.xcworkspace</em> by XCode and add folder <em>“ios/assets/fonts”</em> to project</li></ul><p><strong>Android:</strong></p><ul><li>Copy custom fonts to <em>“./android/app/src/main/assets/fonts”</em></li><li>Open the platform android was generated at folder “android” with Android studio to call link and install dependencies libraries.</li></ul><h3><strong>CALL CUSTOM FONT ON REACT-NATIVE</strong></h3><p>In SheetStyle, set property “fontFamily” with value is a family name that was gotten by you above. Example of:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*euiF-Hw08jESz_v2.png" /><figcaption>H2. Set style font-family with custom font</figcaption></figure><p>Now pls check your result by use the command line to build and run on platforms.</p><p>- Run iOS:</p><blockquote>npm run iOS</blockquote><p>- Run Android</p><blockquote>npm run Android</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/148/0*gwWv0ZmsYv6qm5yb.png" /><figcaption>H3. Result of Android</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/148/0*lVDXFQS4-tPk_S_q.png" /><figcaption>H4. Result of iOS</figcaption></figure><p><strong>Source Code</strong></p><p>You can find the source code for this tutorial on GitHub:</p><p><a href="https://draft.blogger.com/blog/post/edit/1577232203096410943/2040594354840232787#">https://github.com/fabathanhlt/customfontexample</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eecf64bc6b88" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>