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.