Android, app, designPatterns, software, yazilim

App Rater In Android

You can find the source code here: https://github.com/rozeridilar/AppRater

Android, app, book, currency, designPatterns, developer, doviz, dovizkur, doviztakip, ionic, ios, iphone, iwatch, kur, lifestyle, playstore, software, Swift, swift4, takip, Uncategorized, watch, watchkit, yazilim

Time Tracker IOS Watch Kit App

Hey Everyone!

I have started to create some cool apps(or at least trying to create) for IOS WatchKit recently and noticed that it is way too different than IOS iPhone apps. Here I share Clock – In && Out watch app which records your time and gives you feedback for your time tracker.

repo: https://github.com/rozeridilar/TimeTrackerWatchKitApp

Like your work, love your life || vice versa!

If you have any questions on this pls, do not hesitate to write me back.

Lots of Love, Rozeri.

Android, app, book, currency, designPatterns, doviz, dovizkur, doviztakip, ionic, kur, lifestyle, playstore, Swift, swift4, takip, Uncategorized, yazilim

Swift 4 Skeleton Project

Hey everyone!

Here is skeleton project for our swift projects with mvc, shared folders and some objective C libraries(for UI animations- ProgressHUD etc.)

This project is also base of angela yu’s project!

https://github.com/rozeridilar/Quizzler—London-App-Brewery

Enjoy!

Alsoo, here is common auto layout issues both programmatically and Main Board Solutions:

https://github.com/rozeridilar/AutoLayoutWorkSpace

https://github.com/rozeridilar/Dicee—AutoLayoutIssues

book, designPatterns, Uncategorized

Best Book(s) Ever!

Dear All,

If you are interested in not just codding but not repeating your code in any where, I must recoomend ou to read Rob Martin. Uncle Bob, is the man who taught me what OOP really does. Mainly Solid, and not writing the same things n times instead calling the same method or whatever n times, you must read Clean Code. Then, Clean Coder. Tha language is pretty simple for everyone to understand!
http://blog.cleancoder.com/
https://github.com/unclebob51bPR2V9fBL._SX404_BO1,204,203,200_
you may easily find the book in amazon!

lifestyle

Things are Changed!

Hey Guys!

I have noticed that it has been a very very long time that I did not write anything. It is because, when I started to find a solution for my problems in software, only place that I find is in stackoverflow : )

I have already given my replies and solutions in there, so I will not write it back here.

Instead, I think I will use mostly instagram. Follow me on instagram as @codingoals 💻

Hopefully, you will enjoy being here!

designPatterns, Swift

IOS Design Patterns in Swift

Hey Guys! We all heard the term design patterns, and we know that this is very important for our project, yet when it comes to writing code we don’t pay attention too much for reusing codes.Why we care if there is more than one instance of the same class? Or copy paste the same methods in some classes over and over when code and memory is cheap. However, there are some cases  in which it makes sense to have exactly one instance of a class. For example, there is only one instance for your application and one main screen for every device. So you only want one instance for each. Actually Apple uses this approach a lot. So we will examine their patterns and see how to use them to make our codes more readable and increase its reusability. For example, NSFileManager.defaultManager(),UIApplication.SharedApplication(), UIScreen.MainScreen() are the example of the singleton pattern.

If you copy/paste some of your methods in classes over and over OR if you are rechanging the same function in other classes when you are adding a new functionality to the same method, I guess it is time to use Design patterns.

  • They are reusable in multiple projects.

  • Design patterns don’t guarantee an absolute solution to a problem. They provide clarity to the system architecture and the possibility of building a better system.

  • They also help you create loosely coupled code so that you can change or replace components in your code without too much of hassle. 🙂

    Don’t worry we are already using IOS design patterns thanks to the Cocoa! So lets dive into this patterns with simple examples!

    Most Common Design Pattern – MVC

    I am not going to write what MVC is, instead I will show with a simple example. Here is the Model – View – Controller, the king of the patterns 🙂

    The clean separation of the code based on the role.

    • A Model , which represents the underlying, logical structure of data in a software application and the high-level class associated with it. This object model does not contain any information about the user interface.(Basically,The object that holds the data and defines how to manipulate it. It has nothing to do with the UI)

    • A View , which is a collection of classes representing the elements in the user interface (all of the things the user can see and respond to on the screen, such as buttons, display boxes, and so forth)- basically all the UI – derived objects.

    • A Controller , which represents the classes connecting the model and the view, and is used to communicate between classes in the model and view.(The mediator that coordinates all the work between model and the view. It accesses the data from model and displays it with the views – listens the events and manipulates the data if necessary.)

    • A good implementation of this design should mean each object falls into one of these groups.

    model_view_controller_apple

    This is how it works basically.
    Soo lets start our very simple project. First, Open Xcode then select the “Create a new Xcode Project”, Then choose “Page-Based Application”, give the name you want to your project in the “Product”and select the lang Swift and click Ok.Here is your project with 4 swift classes.

    1. AppDelegate.swift
    2. RootViewController.swift
    3. DataViewController.swift
    4. ModelController.swift

    AppDelegate might look like full of mostly empty functions but it is the main file of our swift project. There is a part written “@UIApplicationMain”, this means Xcode will assume this file as the main file.

    ModelViewController  is the place where the data is shown, variable pagedata holds the date to show in init().(Model)

    let dateFormatter = NSDateFormatter() 
    pageData = dateFormatter.monthSymbols
    


    DataViewController is the place where UIView is shown, displaying datalabel.(View)

    RootViewController updates the data from ModelViewController in the DataViewController. DataViewController can then notify the controller of user actions and the controller will either update the model if necessary.(Controller)

Swift

To Design Custom Icon for IOS App

Hey Guys! In android, we developers are really lucky to copy/paste the icons to our app. In IOS However, Apple makes you add very specific sizes. We need different sizes, because devices are different. Ipad, different versions of Iphone… They all display different resolution of icons. Of course, newer models have high resolutions. But we have to think all devices.:)

Sooo, Lets Begin!

When we take a look at image.xassests for our AppIcon there will be Iphone — Iphone Spotlight — Iphone App and so on… The important thing is below this pictures there is “pt”(points). Also, there will be 2x or 3x or whatever for each different size. So All we gotta do is to multiply points with this sizes. For example, In the first picture there is an iphone with 29 pt and 2x size so we must have icon with (29 x 2 = 58) 58 pxs. For other devices you should also have 58pxs, 80pxs, 87pxs, 120pxs, 180pxs…
Also, As you might noticed all icons should be SQUARE. But you can change the image with insets to rectangle or whatever you want.:)

Swift

How to limit number of characters for your textfield?

Hey! Limiting number of characters is really easy if you have standard keyboard. The link below offers so many options for this prob:
http://stackoverflow.com/questions/7010547/uitextfield-text-change-event

But these options werent fit for me. In my case, I had custom keyboard…
The solution I found was pretty satisfying.
I wrote a function to check max length of a text field. Then I checked this func every time I added character to my textfield.

  @IBAction func addBtnLabel(sender: AnyObject) {
         txtFieldPlateNumber.text =  txtFieldPlateNumber.text?.stringByAppendingString(sender.titleLabel!!.text!)        checkMaxLength(txtFieldPlateNumber as! UITextField, maxLength: 14)
     }

    func checkMaxLength(textField: UITextField!, maxLength: Int) {
         if (textField.text?.utf16.count > maxLength) {
             deleteLastCharacter()
         }
     }

//To delete backwards.
 func deleteLastCharacter(){

        if (txtFieldPlateNumber == 0) {
             // textField is empty
             print("text field is empty")
         }
         else{
             var name: String = txtFieldPlateNumber.text!
             var truncated = String(name.characters.dropLast())                       txtFieldPlateNumber.text = truncated
        }
     }

   Thinking simple, creates simple solutions. 🙂

Swift

Create Custom Keyboard Just For Your App!

I’m building an iOS app using a Storyboard. And I had to add custom keyboard for my own app. For designing keyboard I had soo many difficulties(Autolayout is an art, not a science.) But finally I fixed. Then I looked everywhere to use keyboard like a subview. (I did not want to add keyboard like target but just subview.) Soo, Here is what I ended up doing to accomplish everything. The only thing you need to consider in addition to this is to think a basic subview and remove classic keyboard from UItextField.

1- So, I added -Content View- to my View Controller in StoryBoard and I added all buttons that I need for my own keyboard. Then in my ViewController class, to make it add buttons  to UITextField I wrote:

@IBAction func addBtnLabel(sender: AnyObject) {
         txtFieldNumber.text =  txtFieldNumber.text?.stringByAppendingString(sender.titleLabel!!.text!
 }

Then for my delete button I wrote:

@IBAction func deleteBtnLabel(sender: AnyObject) {

        

        if (txtFieldNumber == 0) {

            // textField is empty

            print("text field is empty")

        }

        else{

            //txtFieldNumber.text =  txtFieldNumber.text?.

            var name: String = txtFieldNumber.text!

            var truncated = String(name.characters.dropLast())

            txtFieldNumber.text = truncated

        }

    }

Also do NOT forget the removing keyboard! I wrote some sort of trick to remove standard keyboard in viewDidLoad:

  keyboardToPost.backgroundColor = UIColor(red: 98/255 , green: 102/255 , blue: 102/255 , alpha: 1.0)        

        // initialize custom keyboard

        let keyboardView = Keyboard(frame: CGRect(x: 0, y: 0, width: 0, height: 0))

        txtFieldNumber.inputView = keyboardView

Thats what I ended up.
All files are in my github page with full version of it: https://github.com/rozeridilar/customKeyboard
If you have any questions, don’t hesitate to contact me!