Posted in Design, preferencies, Programming

Let’s think about Test?

Actually not exactly how to start, learn how it works is a bit easy. There’s loads of tutorials for free that teaches how to do Unit Tests and UI Tests and teaches it proper good. But the question here is how to think on your project to start implementing Test Drive Development?

The good thing about using TDD is that when you start actually the hand work (coding… 😉 ) you have most of the project defined already, like what kind of server you are going to use, or what database it’s more convenient for the project, summarising: you will likely have the specifications of the project already set. So this way, you just need to think of your code.

And here we go…

let’s say we are going to build a simple app that tells you where you left your car. When the user park his/her car, he just press the button to mark the place, then when you can’t find anymore, just open the app and it will find for you.

This is how I would do it:

  • first of all we need to define our model, that here is a object of position (as I’m well creative, I would call Position :p ). The object will be saved and displayed in the view. So I would start the test with this object. You know, the red-green-refactor process.
  • Then I would start with the class that deals with this objects. But here we will have to know what kind of method we want to use to access and manipulate the position object. The question here is: what is necessary ?
  • After that, we need to test the UI and controllers that will trigger the manipulation of the object.

This is quite straightforward if you think about it. The secret is ask the right questions 😉

Advertisements
Posted in Design, Programming, Uncategorized

ZodiChat

You know that person that just clicks with you?

That you feel you know him/her for ages?

You know that it can happen due to the characteristics of your zodiac sign?

Yes its true! ZodiChat can help you find that specific sign with those characteristics that you just get along with. From everywhere in the world, It can be in the same area that you live or in that exotic country that you are going to spend your next holidays.

It’s quite easy, just login with your Facebook or Google account then start searching and talk to people with the zodiac you wish for!

You don’t need to be in the search of your other half, you can make friends as well! Meet and talk with as many people as you wish and you can set what you are looking for: either friends, love or just no commitment. Find it here on ZodiChat, let the universe connect you and bring you what you wish.

 

::https://itunes.apple.com/ie/app/zodichat/id1214044751?mt=8

Posted in Programming

Dependence Manager

Why do I want to reinvent the wheel? Why should I spend precious time writing code and solutions that was already written ? So that’s why it’s handy to use a dependence manager, like CocoaPods. If you don’t know what it is, here’s some enlightenment from Bryan Irace, that explains, in Objective C, the success of CocoaPods. I’m going to explain how to do it in your project. If you don’t have a project create one with this easy tutorial. And it’s nice to use gitHub to version, so if you don’t know how to do it, this is another easy tutorial about how to do it. The first thing you need to do is install the cocoa pods, if it isn’t installed in your mac. Just open the terminal and  type: “sudo gem install cocoapods” (with no quotation marks). And then, it’s going to ask for your mac password and that’s it. It’s going to install the cocoa pods or update it to a recent version. Next step is to use it on our project. Just navigate to your project with ls and cd on the Terminal

Navigate to your project
Navigate to your project

and then type: “pod init” to initialise the pods and then “pod install” and then it will start installing, as it shows in the image below:

Installing Pods
Installing Pods

After the installation you will always open the projectName.xcworkspace to open your project, and you can open with the terminal if you want, you just need to type ( in the current folder you are in ) “open projectName.xcworkspace”. And you can use your dependency normally, like you would import any native class:

#import <Reachability/Reachability.h>

And to add any dependency, you just need to open the podfile, ok, because you typed “pod init” on your terminal, CocoaPods automatically created a file called Podfile with smart defaults. That means you just need to open in on xCode ( you’re already on terminal, why not write “open Podfile” and get done with it? 😉 ) type:

open -a  Xcode Podfile

this is the print screen of what is written in the file

podfile
podfile

ok, now you’re going to write what library you will want before the target keyword :

pod 'NameOfTheLibrary', '~> version of the library' 
pod 'AFNetworking', '~> 2.0'

And what if the library is not included in a specs public database ( contained in the cocoapods ). Easy pizzy:

pod 'NameOfTheLibrary', :git => 'gitPath', :commit => 'Especific Commit'
pod 'Artsy+UILabels', :git => 'https://github.com/Artsy/Specs.git', :commit => '7088b16209'

Now you just need to install the new pod: “pod install“.  And to make sure everything is ok: “pod update“. And it’s done.

Posted in Programming

Get yourself a Git!!

Ok, we have the project and now we need to make it ready to version it and then, no more headaches. If you don’t have a project, create one following thise simple steps. So let’s start.

The first thing you need is to have an account on GitHub. It’s very easy, no problems: GitHub Account.

And following with the easy part, on the right top there is the plus button.

GitHub start page
GitHub start page

The plus button is a fast lane to add a new Repository or a new Organization. We want the new Repository, of course.

New Repository GitHub
New Repository GitHub

And after that…

Creating a New Repository on GitHub
Creating a New Repository on GitHub

We just need to set our repository details, I mean data as the name of the repository ( actually the name of the project) and a description. The user has to chose if it is a private account or a public. GitHub is an open source network, and encourages you to always make it public in a very effective way: billing the private projects. That means you have to have a paid account to have a private project. That’s why mine is public 😉

And just hit Create Repository, no secrets, no changes at the rest of the settings. What will lead you to this screen:

GitHub New Empty Repository
GitHub New Empty Repository

Quite creepy, isn’t it?

Yeah! but this is only GitHub telling what you’re supposed to do, in our case, with Terminal on our Mac. That means the GitHub part is practically over.

Let’s head to the Terminal and navigate with ls and cd to your workspace (for mac users: alt/option + tab helps to fill the folder name, but beware of the capitals)

Navigate to your project
Navigate to your project

ok, looking back to the last git string, it shows us a interesting (creepy) code:

echo "# AppName" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/nanyoliveira/AppName.git
git push -u origin master

But actually this code, beside creepy, is teaching us what we have to do on terminal (if we already don’t know).

First of all let’s initiate the git into the project folder on Terminal with “git init”. Yeah. Just like it.

And then just add the changed documents with “git add .” ( yeah, with this point after add, and a space before the point! it tells the computer you want to add all the content in this folder).

And then do our first commit, please write a nice message 😉
“git commit -m “the basis of our project” ” (like that, with the message under double quotation marks).

One of the main things is the telling your mac where it’s going to send your project, so that’s why you add a origin with “git remote add origin” with the secured url(https://) where the .git is -> git tells you in this creepy code part:

git remote add origin https://github.com/nanyoliveira/AppName.git

and then you just hit push. Oh! yeah, in a git way: “git push -u origin master”

if you have a brunch on git, you can push to your brunch name: “git push -u origin brunchName”.

The terminal it’s going to ask your username to github and your password (it’s ok, the password, for security reasons doesn’t show when the user is typing). And voilá! It’s done, just reload your Github repository to see your beautiful project in there.

Posted in Programming

Creating a project

This is definitely the easiest part of a project. And, probably every developer knows. I don’t know about you, but I’m fed up with every tutorial in web you have to pass through it. So I’m going to do different. There’s why I’m going just to create a project here.


Open the Xcode and click on Create a new Xcode project as showing in the image below

Xcode start menu
Xcode start menu

Now, in the left menu IOS, click on Application  and choose Single View Application, as shown in the image below.

Xcode application type screen
Xcode application type screen

Now it’s time for the New Project Set Up.

Xcode New project options
Xcode New project options

In this screen you an set all basic things related with your project, where the Product Name is the name of your app.

Organization Name is optional, and it’s the place you sign your project company’s name that shows up in App Store.

The Organization Identifier is the main source of the Bundle Identifier, which is your application ID that needs to be unique and uses the reverse domain name service to make sure of it.

You can set in the language, at this current moment, you can use either Objective-C or Swift, as shown in the picture below

Objective-C or Swift
Objective-C or Swift

After pressing Next, you will be lead to chose where in your computer the project will be allocated. I suggest a specific folder to use as a Workspace, I have to myself it’s more organised this way.

Place to save the project
Place to save the project

After pressing Create, you will be able to see all the project details and folders. The image below is a print screen of a swift project:

Xcode project created
Xcode project created

Now it’s just start coding, or planning a UX 😉