Monday, September 16, 2019

How to customize your date according to Timezone in Swift 5


What if we want to unite time in different country for all users that install our app. Yes we can use one timezone for all users. Example we use Asia/Jakarta timezone then everyone who install our app will get same time. But you have to work together with your API developer, so API will send same timezone to all users. And in our app we will get it and convert it. It's not difficult to do it. I will show you how.

I use swift 5, because that's latest one. I haven't used objective-c because no project that write use it. Swift actually more simple than objective-c but it's same. It uses iOS OS. Xcode is helpful tool to write iOS app. But if you use xamarin, it will be ok but the language is not same at all. You need to research again.

You need to understand basic thing about timezone. What is your timezone in your country ? you need to know UTC and GMT because iOS use these.

Thursday, September 5, 2019

How to disable UITableview ScrollView Pagination when Data is Still Fit In


Hello guys, if you ever work with UITableview. Sometimes you need to do pagination and there many ways to do it. One of them is using scrollview. I want to share with you my improve way to do pagination because on the internet. It needs to improve a little bit.

Why you need to do pagination because it will make your app run lightweight and more fast. Because you just load API as necessary. Many greats app use this and if there are images you don't load all. It's just load the first page one.

Fortunately iOS support it and we can use UITableview to do it. UICollectionView can do it too but we talk it later on the next post.

So check this out.

Wednesday, September 4, 2019

How to disable touch outside to dismiss and swipe in Side Menu Swift


I find a problem where I need to disable side menu to dismiss. So basically it's just showing side menu and view controller behind it. I use library https://github.com/kukushi/SideMenu because I look it simple and it support swift 5.

I need to custom it because in my side menu I have parent and children so I need to customize it manual. But in here I don't tell you how to do it because my focus is to disable touch outsude and swipe. Sometimes you need to do it in some UIViewController. And Side menu library don't explain it explicitly. So I need to figure it out by myself and it's not harder to do find it out.

In Side Menu it works with gesture so I need to get all gesture and disable it according to what I want to disable. In this case swipe gesture and touch outside. You can see in my code I put it in ViewDidApper and ViewDidDisappear because I just want disabled feature in this only UIViewController.

Sunday, August 11, 2019

How to set first day of week in DateRangePicker Calendar Android


I have created an app called "To Do List Extra" that has a calendar. I found a issue that i need to set first of week to saturday or monday. By default calendar will be sunday. So i tried to ask on the internet and finally found the way. Locale will make a different first day of week. I just changed the locale and automatically the first day of week will be changed too.

Why I need to set first of week because in different country we have diffrent first of week. In my country first of week is monday. It's very helpful we don't need to adjust the calendar. DateRangePicker is default Android library so it's not complicated to customize it.

In my app We have to add task and put date and time if you want. I have notification timer so it will put banner notification when your task date and time is suitable with time right now. So basically it's important to set first of week.

Thursday, April 11, 2019

Problem UICollectionViewController When Trying to Use bringSubview Swift 4

Hi guys, I found unique issue when trying to use bringSubview in UICollectionViewController. The method doesn't work if you try like this.

UICollectionViewController has a diffrent to do add subview. Because it's not pure UIViewController itself or parent. It needs to get superview to add a new view.

So basically you do like below and nothing happened or it doesn't work. Don't worry about it, i have a solution for you. It's simple way to do it and don't make you think too much. I find this idea on stackoverflow. I will put the link below.


self.view!.addSubview(something)
self.view!.bringSubview(toFront: something)

So to do trick you need to use superview!.