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.