Posts

Showing posts from March, 2020

How to pass through click event in UIView and UITableView

Image
Hello guys, We are now have pandemic that makes many of us stay at home. Sometimes we are bored to do something at home. But we need to do something helpful for our life that's why  I'm creating an app that I want to explore with MVVM architecture and new layout. Before I used to always use MVC to create an app. It's good to know other architecture like MVVM or VIPER. I have started to like using MVVM architecture for my project. If you MVC, you would face the controllers have so many code to handle business logic and UI. If we can seperate business logic to create the class itself, it would be good. The class itself, we call it "ViewModel". We do our business logic in there. Maybe next week I will share my structure project to show you how I handle my project maintable and easy to organize. But today I don't want to share about architecture in programming but about iOS layout as you can see above. I have two images, there's a button on top right ca

How to make NSMutableAttributedString work with emoji Swift 5

Image
Hello guys, last week I got an issue related to NSMutableAttributedString. It couldn't work with emoji, when I entered three emoji like " 🤣 🤣 🤣 ". It would only show " 🤣 🤣 " not three emojies. So basically we need to handle about the length of emoji. Because it's different if you don't cast String to NSString. Sometimes we use NSMutableAttributedString than String only because we want to customize our text like giving it a link and changing the color. Because when we use NSMutableAttributedString, we can give the business logic how it will show in view controller. And it's easy to work with TextView. We only can do "textView.attributedText = NSMutableAttributedString". And it will automatically run like we set in NSMutableAttributedString. If you don't work NSMutableAttributedString, you would not counter this issue. Because I have tried not to use NSMutableAttributedString in TextView. It just works fine. The solution for t

Avoid Retain Objects When Using Static Var Swift 5

Image
Welcome to my new article, I've just learned about memory in iOS.  It's actually not hard to understand because of ARC (Automatic Reference Counting) that helps a lot about handling memory. But you need to handle a few conditions that ARC can't handle. It usually uses "weak" syantax. It tells to memory that It is not strong pointer. It's literally variable that is used "weak" can be nil. "weak self" and "unowned self" helps us when we use closure and try to self inside it. It will make iOS can handle better your apps. Use "weak self" if self could be nil and Use "unowned self" if self will be never nil. It's actually confusing for the first time we have heard the theory. So we need to practice it to make it perfect. But what I actually concern is when we use static var in enum or struct. And I try to access it in view controller or other classes. It will make class or view controller doesn't ru

Share My Software Aplikasi Apotek Gunsoft Java SE

Image
Hello guys, welcome back to my simple blog. Today is good day for you This is my software that I created in 2014, I think this is one of my best software that I created and took much time. The app is called "Aplikasi Apotek". It means pharmacy application in english language. I'm sorry it only support Indonesia language. You can see the application above, I was using Java SE and It was pure Java. I didn't use framework like Hibernate, Spring, Struts and etc. Sorry maybe I mislead about it. Of course it uses many libraries that I can't tell here. And about the reports I used jasper. It's very good choice I made because It can cover my all reports. It basically needs to run in windows, but linux and macOS acceptable. But there's a disadvantage about the UI. Like button above it cuts off. I created this application from zero, and It finished about 9 months. Is it crazy ? haha. I created this application just for fun and I hope I can earn money from thi