Saturday, June 27, 2020

My first flutter app on Playstore but rejected on AppStore



It's been a month to learn flutter and I really like the idea of designing user interface. No heavy storyboard in Xcode. No more many xml that is on Android Studio. But everything is using dart class. Design and code logic. That's painful for me is bloc pattern that I used. It's good for MVVM pattern I think but I need to create three dart class to handle one screen one bloc. But fortunately It worked on Android and iOS and that's cool.

Okay the app that I created it's called "Helper for Instagram". Basically it helps you to repost, download photo or video and copy caption, hashtag and username and selectable caption. It gives you to "history" to show you what link you have inserted and "save" for favourite post that you want to save. And they will be in app as long as you don't uninstall the app.

For Android the size of the app is 10 MB that I think it's very good because it's native. But for iOS it's 30 MB. It's not bad though. If you're in debug the size will reach almost 100 MB and as I read on the internet it's fine. Debug size certainly is more than Release size. I have ads for my app and app in purchase three of them. I made it to have expierence more, it's usually I only have one in app in purchase. But that's awesome in flutter there's package called "in_app_purchase" and I amazed I can easily add one more.

Monday, June 1, 2020

My Impression about Learning Flutter from scratch




It's a busy month for me to learn new stuff. I'm hungry for knowledge about flutter things haha. I have already learned about android and iOS native long time ago. And it's still awesome to learn. It's been a great long journey though. Now I maybe have learned anything about flutter about two weeks. Learning it from video tutorial is awesome. Don't worry what you learned, it will make your skill more sharp when you learn it everyday. 

First, I confused when to start to learn flutter. That's why I tried to learn directly from flutter documentation. But I need real world example flutter project from case study. That's when I found a good tutorial and easy to understand. It's Flutter course from londonappbrewery. It's free actually because of google. 

But if you need to grasp all of flutter course bootcamp you need to spend 10 bucks. It's very good I think you will learn flutter until Flutter State Management. It's important aspect to create project using flutter. You need to handle state for your apps. It's different from iOS and Android native. If you need to change something directly when your apps is running. You can't make UI changed without using states eventhough your variables changed in console.

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.

Sunday, April 12, 2020

How to cache image for temporary use iOS Swift 5


Welcome back to my blog, this week I was too busy to do so many things. I've almost forgot to post new article this week. So I look my old problem that I've already solved and found a problem how to cache image for get dynamic height of UITableview.

I have a problem to reuse UITableViewCell for inserting the height of each cell. I want my cell to display flexible height for UIImageView. And the image itself is fetched from API server which is to need internet to get it and it's not from local. Sometimes it takes a long time to get big size image.

For the very first time to open an app. It will be harder to cache all of images. So if the user doesn't have good internet connection. Cache all of images is good solution, but it will not automatically resolve our issues. For me there's still a little issue when I want to make my height of UIImageView flexible in UITableView. If I already get the height of image, I need to reload the spesific of uitableview row. And it will make weird for UX.

Wednesday, April 1, 2020

Fix "Attempted to call -cellForRowAtIndexPath: on the table view while it was in the process of updating its visible cells, which is not allowed"


Hello guys, Today the title is a little bit long. Because I want to make the title can be searched exactly the same on google searching. This is a warning not a error. So It wouldn't impact to your app if you run it on your device or emulator. The warning appeared on console not in Buildtime as usually in issue navigator.

This warning doesn't give the exact line number where the warning happened. So we need to do breakpoint to check where it's supposed to be. But the warning in console give us a hint. We take the keyword "cellForRowAtIndexPath". So it related to UITableview because "cellForRowAt" is the method that's in UITableVIew.

As you can see my screenshoot of my console above, there's multiple times the warnings happened. It's because of "cellForRow" called many times, not just once. But don't be deceipted to assume that the warning happed in cellForRow method. The warning actually happened in "heightForRowAt", when in the method, it called dequeueReusableCell, the method of UITableview. As you can see in example below.

Wednesday, March 25, 2020

How to pass through click event in UIView and UITableView


Hello guys, We are now have pandemic that makes many of us stay at home. Sometimes we are bored to do something at home. But we need to do something helpful for our life that's why  I'm creating an app that I want to explore with MVVM architecture and new layout. Before I used to always use MVC to create an app. It's good to know other architecture like MVVM or VIPER.

I have started to like using MVVM architecture for my project. If you MVC, you would face the controllers have so many code to handle business logic and UI. If we can seperate business logic to create the class itself, it would be good. The class itself, we call it "ViewModel". We do our business logic in there. Maybe next week I will share my structure project to show you how I handle my project maintable and easy to organize.

But today I don't want to share about architecture in programming but about iOS layout as you can see above. I have two images, there's a button on top right called Show. You can click the button and It will show you another view controller. But on the second image as you can see the show button is behind another layout. It means the show button is behind another UIView. But the view itself is clear background actually.

Wednesday, March 18, 2020

How to make NSMutableAttributedString work with emoji Swift 5


Hello guys, last week I got an issue related to NSMutableAttributedString. It couldn't work with emoji, when I entered three emoji like "". It would only show "" not three emojies. So basically we need to handle about the length of emoji. Because it's different if you don't cast String to NSString.

Sometimes we use NSMutableAttributedString than String only because we want to customize our text like giving it a link and changing the color. Because when we use NSMutableAttributedString, we can give the business logic how it will show in view controller. And it's easy to work with TextView. We only can do "textView.attributedText = NSMutableAttributedString". And it will automatically run like we set in NSMutableAttributedString.

If you don't work NSMutableAttributedString, you would not counter this issue. Because I have tried not to use NSMutableAttributedString in TextView. It just works fine. The solution for the issue is very simple you just need to cast String to NString. Why you need to cast it to NString because the length between String and NString are different when they work with emoji.

Tuesday, March 10, 2020

Avoid Retain Objects When Using Static Var Swift 5


Welcome to my new article, I've just learned about memory in iOS.  It's actually not hard to understand because of ARC (Automatic Reference Counting) that helps a lot about handling memory. But you need to handle a few conditions that ARC can't handle. It usually uses "weak" syantax. It tells to memory that It is not strong pointer. It's literally variable that is used "weak" can be nil.

"weak self" and "unowned self" helps us when we use closure and try to self inside it. It will make iOS can handle better your apps. Use "weak self" if self could be nil and Use "unowned self" if self will be never nil. It's actually confusing for the first time we have heard the theory. So we need to practice it to make it perfect.

But what I actually concern is when we use static var in enum or struct. And I try to access it in view controller or other classes. It will make class or view controller doesn't run deinit which is we need to know our view controller is discarded and it makes our memory cannot be leak. So How do we solve it ? It simply like we have talked before. We need to use "weak" syntax before "static var". So the memory will discard it when no one points to variable. I will give example below, don't worry.

Tuesday, March 3, 2020

Share My Software Aplikasi Apotek Gunsoft Java SE


Hello guys, welcome back to my simple blog. Today is good day for you This is my software that I created in 2014, I think this is one of my best software that I created and took much time. The app is called "Aplikasi Apotek". It means pharmacy application in english language. I'm sorry it only support Indonesia language.

You can see the application above, I was using Java SE and It was pure Java. I didn't use framework like Hibernate, Spring, Struts and etc. Sorry maybe I mislead about it. Of course it uses many libraries that I can't tell here. And about the reports I used jasper. It's very good choice I made because It can cover my all reports. It basically needs to run in windows, but linux and macOS acceptable. But there's a disadvantage about the UI. Like button above it cuts off.

I created this application from zero, and It finished about 9 months. Is it crazy ? haha. I created this application just for fun and I hope I can earn money from this application. But it's ok, It was six years ago. And I'm ok with it. That time, I was still in college. I love programming since I was in senior high school.

Tuesday, February 25, 2020

Learning About Initialization Properties in iOS Swift 5


Hello guys, lately I have watched a good video to learn about iOS programming. It's CS 193P from standford university on youtube. Although I have learned iOS programming more than 4 years. I'm amazed about things that are learned.

Many things I haven't noticed about deep language in swift. I'm so glad that swift is so powerful language. Thanks to the ones who created it. I haven't finished all tutorial videos. But soon day after day I will watch it. Never stop learning when we're in technology haha.

Today I'm gonna share something simple that I haven't used in my project. But I think on the future, I will try to use it. So I will call it "Initialization Properties". You can create "set get property" with closure in swift. It's so easy to do it like example below. And you can do willSet and didSet property condition in method. It's very useful for me when I'm usually put initialization in viewDidLoad.

I haven't found this powerful syntax in java, but I haven't expierenced in kotlin. And I think it must be followed by other programming languages. Easy to use and easy to understand that's what I think about swift.

Wednesday, February 19, 2020

Add Padding Bottom in RecyclerView Android


Hello guys, on this week I want to share something special but I think it's useful for us. It's understable from the title of this post. But I will explain a little bit why I used padding bottom for my RecyclerView in Android. I have something called floating button to add my item in RecyclerView. It will be bad If I scroll to bottom and my floating button above item RecyclerView. I can't see clearly what text item in RecyclerView.

You can see from picture above, I've marked a rectangle in picture above. Imagine if there's no padding bottom. It will truncate my RecyclerView items and it will make my app looks when in interface. So I think I need to have padding bottom in RecyclerView. But How do I do that ? Is it hard to implement ? Or Is it just a few code lines.

I want to make "adding button" always be bottom right on my view and I don't want it to stack above RecyclerView. So the easy solution is to add padding. I changed my xml file layout and I added paddingBottom to 75dp and clipToPadding to false. I added these in RecyclerView widget as you can see below.

Tuesday, February 11, 2020

Create Smooth Dropdown on iOS swift 5


Welcome back to my blog guys, today I want to share something about dropdown thing. Dropdown is not something that is exist on iOS UIKit. On iOS we have something similiar to dropdown menu Android that is Picker View. But sometimes we need to create UI same as Android. It will have better User Expierence.

Fortunetely some people have dealt with our problems. So they created the dropdown menu in their own. What I have used is what I'm gonna share today. It's DropDown created by jriosdev, I will share github link on below, don't worry about it.

You install dropdown in your project using CocoaPods, or You just simply add Dropdown library by creating class named DropDown and add Textfield in your Storyboard then change class Textfield to Dropdown. For more details how to install this library you can check their github. I will give the link github below OK.

Tuesday, February 4, 2020

Fixing Problem UIActivityViewController Share Photo Function Not Working Sometimes


Hello guys, today I got a problem when no errors or warnings message in my IDE (Xcode). It's so confusing for programmer when error happens for no reason. It's like magic we don't know how it happens lol.

When sharing, I use iOS class library UIActivityViewController. It's a feature from iOS when we want to share something on other platforms. Like above image when we want to share something using UIActivityViewController, it will appear popup view dialog like above. You can choose what platform you will want to share.

Basically, UIActivityViewController can provide text and image together. But on some app like Whatsapp, it only applies image or text not both. I have shared the trick to avoid always sharing text when we want to share image.

Tuesday, January 28, 2020

Method Called When Notification Silent is True or False iOS Swift Firebase


Good day guys, today I want to share about iOS programming. Before I got the idea of this article, I got an issue. The issue is when you want to get notification data when user click on notification banner or user is running the app. It's different way to get the notification that I will give you the code below But I will explain a little bit first.

I have tried with firebase library, so make sure you have configured your firebase or any libraries that you used for your notification. But it will be better if we used the same. You need to set it according to documation that I have read. Mostly the configuration will be in AppDelegate class. Then from AppDelegate you will go into your others ViewController.

There are the method that's called that I want to show to you guys, the methods is userNotificationCenter and didReceiveRemoteNotification. I will give silent true or silent false comment for you guys. So It will be easy for you to understand what I'm trying to figure it out.

Tuesday, January 21, 2020

Sharing AFK ARENA Game That I Play Everyday


Hello guys, today I doesn't share about tutorial coding. I keep it for next week, because I want to have variation in my blog. I love playing game to waste time when I'm waiting to do something and make me not bored. I played many mobile games before that I shared sometimes on youtube like Mobile Legends, PUBG, Ragnarak Eternal and World of Kings.

World of kings is latest game I've played genre MMPORG. It's consuming so much time and I stopped then. Fortunely I found a good game that we can play anytime in everyday. It's called AFK ARENA. It's released on April 2019. It's mobile games that created Lilith. The developer is good because they sometimes heard the comunity.

There are two forums that I followed about this facebook and reddit. I played this game last year september month I think. It's about 5 months so far. I created four accounts because I like it to do daily and when we draw to get heroes card. That's making sick for hoping RNG hahaha. That's what community said.

Tuesday, January 14, 2020

How to Make Blinking TextView Android



Good day guys, It's the second of week on 2020 year. We need a good boost to start every day to do something good way. I listened to many new songs and old song too. It's good to refresh my brain to think. Creating an new article every week it's not easy though. I need a problem to solve haha. Maybe I will share what game that I am playing on the next article.

We can see how many visitor in our blog, for me it's not much people see my posts. But I'm gratefully my post will last long because it stands on Blogger. We know blogger it's so long, and I hope it will be better for the future.

So the article for now, it's about TextView Android. I have an app called To Do List. There's a fragment calendar where you can click the day and you will be directed to the date in list view fragment task lists. So it's very helpful for users to choose where they want to see data according to date. Like images above what I mean about.

For making user friendly app. I give a little bit animation blink, so user will notice where the date of header position. The code for this animation, it's simple. It's just a few lines. So don't expect it's too hard to try. You can customize this animation according to your app wanna be.

This is the code guys.

Tuesday, January 7, 2020

Avoid Whatsapp Share Only Text in UIActivityViewController


Hello guys, this is a good day to start a new resolution because. It's still fresh 2020, we can start doing something new or something that we want to complete when this year ends. I hope I can always write a new article every week with good quality. Thanks for support to be consistence it's hard and easy to do if you are in perservence mode.

If you ever have installed app called instagram or others social media, you will find a share feature. where you can share your photo to others app. Like email, notes or social media. Fortunately iOS provide the feature to share called UIActivityViewController. So it's like we use library in iOS, we just create our text or photo sending to UIActivityViewController. Then it will create share feature like above.

But I have a problem when trying to share on Whatsapp. It just showed text when I sent image and text. Unfortunely Whatsapp only support image or text, not both of them. So we need to choose what's gonna we share. In my case I need to share image without text, so how do I check when the user share on whatsapp spesificaly.

So I created two classes for each items. SocialActivityItem and TextActivityitem, SocialActivityItem for sharing image and TextActivityitem for sharing text. It will extent UIActivityItemSource so in order to be used in activityItems. If you're confused with what I'm talking about, I will provide the code for you guys. Sorry I'm not expert to explain something :D.

So this is the code guys.