Friday, May 15, 2020

Create Button Auth Facebook FBLoginButton Full Width


In my app Dog Master, I have authentication to log in from two platform that are Google and Facebook. Basically I used the login button that is created by Google Firebase and Facebook. These two button are in different width. As you know the google button sign in is easy to be designed in storyboard. But Facebook it's fixed width if we want to make it full width in each edge of screen, it would make space padding.

In this post, I don't talk about how to auth with facebook. But for additional information I used authentication with Firebase auth. It's easy to use if you follow the tutorial given by Firebase documentation. If you have any issue about it maybe I can help you. Just comment below this post.

As you can see above screenshoot image, the facebook login button is basically only the facebook icon and "Continue with Facebook" text. Without blue background behind it. I customized it using UIView and I added tap handler to click FBLoginButton. I created this button on UITableViewCell, so it's basically same with UIViewController. 

Saturday, May 9, 2020

Review Skeleton View for iOS Swift 5


Happy day guys, I hope you are happy and calm. In this tutorial, I'm gonna talk and show to you how Skeleton View works. Many apps nowdays are using it. It's like a common way to load something that's not finished yet. You can use it for loading text or image. And I think it's very good UX. Not jut bored loading spinner by default.

You can use Sekeleton View for UIImageView or UILabel. That's what I used for my app and I will show you later. Before I used Toast-Swift to handle loading. The code is pretty simple though but I still used it for loading stuff. I usually calls this code "self.view.makeToastActivity(.center)" to show loading spinner on center of screen. And After load API finished I hide the loading spinner using self.view.hideToastActivity(). Just like this.

And If you use UITableView, you need to implement SkeletonTableViewDataSource to give Skeleton an idea how to react spesific UITableViewCell through cell identifier. And If you don't it implement it, it's not working I have tried and that's confusing me a little while.

Thursday, April 30, 2020

Create UICollectionView Like Instagram When Exploring Photos


Hello guys, I hope you're doing well. I was doing research about how to make my UICollectionView like Instagram. As you can see on picture above. I have time to search on the internet but somehow I want to custom it by myself. I mean I don't want to use framework.

After I finished my custom UICollectView, I found IGListKit framework for building fast and flexible lists. But I haven't used it Because I think it's not for custom layout UICollectionView. But if I have much time maybe I will try to use that framework. I think it's cool to use framework that's built by iOS Instagram Developer.

What I want to share is a  custom class UICollectionViewLayout called SavedCollectionViewLayout. Because I used this class to show my saved collection photos. But you can edit the name as you want, no problem at all. But I think there's a room for improvement this class. If you have any idea to improve this code. Tell me. I'm glad I have someone to improve my code quality.

Saturday, April 25, 2020

Make Difference between Double Tap and Single Tap in UIView


Hello guys, today I want to talk about Tap in iOS. Of course in swift because Objective-C now is less used for iOS Developer. If we see Instagram app, we can tap an image with double tap. After that an event has occured. If it's in Instagram we can have an event which is we like that photo with heart animation color changed.

If we single tap, it doesn't do nothing in photo but in video we can play the sound of the video. But if we double tap it, the sound would not interrupted by first tap. If we don't set something in iOS code, we can see interrupting happened.

Fortunately we can handle it easily in coding with swift. It just need one line of code to avoid interrupting single tap. But first make sure we have added two gesture recognizer. UITapGestureRecognizer is the class we need it to set. Don't worry I give you an example below.

Friday, April 17, 2020

Be Careful with "UI API called on a background thread"


After maybe one months I'm quarantined, It's so bored to be at home without doing anything. Luckily I have projects to do. And Of course to write post for this ungapps blog. Today I'm glad I can write to make my english writting better. I think day after day my english gets better haha. Yes honestly I still used google translate to translate some vocabularies that I literally have forgotten.

Today, I want to dig a little bit deeper about Thread in iOS Swift. We need to learn this thing. Because It's very important when we're doing UI think with other thread like downloading video. Because if you don't pay attentation enough, your app would be like freeze in a moment. And It's very bad for User Experience.

Luckily Xcode helps us to catch something that's not right. It would show message like title above "UI API callend on a background thread" in a specific line of code. To do that you need Runtime API Checking is ticked. Edit Scheme->Run (Debug)->Diagnostics->Runtime API Checking. By default it should've been ticked.