Posts

Showing posts from October, 2019

How to get thumbnail from video URL in Swift 5

Image
If you want to show video in your app and you want to show thumbnail. The easy way is to get image url from server API. But there is more easy way you just need to get url video and get image url. I have searched on the internet but what I found my app becomes lag. I use UITableview to show the video thumbnail url. Maybe you wonder why I use image thumbnail. I can use video player from iOS and thumbnail video will be shown. But what if you use many thumbnail in UITableview, it will be heavy in the device. It's bad design too. It will be good for you, if you can combine this extension image with SDWebImage. Because the image will be in cache and you don't need to reload image again. But you still need the internet to load the video url. Because it's online from the internet. This is swift code and about objective-c code, it's better you search on the internet. I know it's really painful to change it to swift if you have developed big app. So you can convert

Create Rectangle Bubble Chat iOS Swift 5

Image
Hello all, every week I try to give you a good tutorial to add your skill and knowledge too. And today you got to be suprised because It's not usually tutorial. I need to dig it deep down to present it. So if you want to create chat application, it's good for you. You can take it as reference. So in chat application, you will face chat from bottom to up. As a screenshoot above, you can see it's not from top to bottom but otherwise. There is bubble chat on left and right. You can say when you send it will be on right and when someone send, it will be on left. And about text height, it must be flexible height. Like app chat line or whatsapp, there is no cut in height. So it can small or so high. So we need to calculate the height. And about the width it's not full, we give space to the right or left. I include the title header too so It will be more like chat app. The header will be on viewForFooterInSection why ? Because I reverse the UITableview, so the chat wi

Double Tap Zoom to The Tap Location Swift 5 iOS 13

Image
Hello, I find a problem where user wants to zoom to the tap location in ImageView. Actually ImageView inside UIScrollview. Because it's not just zoom when double tap but user can zoom manually with pinning. So basically it's like gallery album in iPhone, you can see it. When I try find the way on the internet, it doesn't work like the way I want. Double tap to zoom working but it just zoom on the center not to the tap location. You need to combine UIScrollview with UIImageview to use gesture zoom. Because UIImageview itself doesn't use scrollview so it will not effect scrollview. Maybe in iOS version before 13 the way on the internet it works. Because I see some posting get upvote and every comment say it works. But in new version of iOS we need to check again. So it's like swift version language. It has developed better again. So I finally combine answer on the internet to make what I want. So  this is the code

Avoid Create Multiple Album in iOS Swift 5

Image
Do you ever have an application that can download photo from your app to your album gallery ? It's not so complicated to do it, if you have the library that I will share to you right now. When you save your photo sometimes you need to create the album first then put the images in there. So It's neat too look. You can name your album with name of your app name. So the trick is everytime user will download you call create album method. In this method you check first if there's an same album created or not. If it's not then creating new one otherwise don't create. Because in iOS create same name, it's permitted. So it will be bad if you create many albums with same name. And if you reinstall the app, maybe the app will create the same album if you don't check. So it's our job as programmer to handle it. To make the user doesn't need to delete the same album. I personally want to know the way before I didn't reliaze that my app create multiple

Solution UIViewController Not Full Screen in iOS 13 ( Bonus My Extension )

Image
Good october month all. Have you installed iOS 13 in your device and you get suprise that some of your views have a gap on the top like picture above. It's bad or good news for us developer iOS. First it looks new and some people may love or hate it but in iOS 13 it becames default system to use it. You need to change it manually every view controller, if you have many it becames many job to do it. Why we need to change it back to fullscreen, because I have view that has not to come back to previous view. It will be bad for user expirience to swipe up and go back and what they get only splashscreen and don't go anywhere again. It needs to reopen app again. This is my case in my apps. Fortunely it's not hard to change it back to fullscreen again. It just needs one line code to change it but if you have function everytime you do presenting view controller. You just need to add one single line to make it fullscreen but if you have many present function in many classes