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.