Posts

Showing posts from 2015

Free Hand Drawing on Google's Map View

Recently, I got a chance to work on a project, where we needed to provide an ability to users of an iOS app to draw on Maps. Basically, we decided to go with Google Maps, because of its overall coverage and its popularity. Hence, we used  Google Maps SDK for iOS  and we wanted to implement "Free Hand Drawing on the Google Maps". To do so, I started searching around the internet for some good resources, but weren't able to find any good one that could just be used like Plug and Play. We had to do a lot of handling on our own and hence decided to write a blog post and a sample project just to make it useful for others, so that others in the same path don't struggle much like me. If you are only planning to draw a Polygon on the Map (As most of them do), then may be you don't have to read the entire post. Instead just follow these steps: (i) Copy & Paste these Folders into your project: "SARMapDrawView", "Categories" & "Models

Optionals in SWIFT

In SWIFT, an interesting and a powerful feature that i liked mostly is "Optionals" . Can you imagine, how many times you have checked a variable in Objective-C for its Validness, (If it is nil or not) ? How many times do you think, you might have written the below code in Objective-C: NSString *string = someFun() if (string != nil){ //do some stuff with the returned string here } I can’t even count on this, since i do this often throughout my classes. Apple have done a great job to solve this issue with Optional variables. Let’s look into this feature more deeper with an example to understand its use and purpose. Consider, you have an array of strings of Phone Numbers as below: let numbers = [“9876543219”, “9898878890”, “9876556789”] We’ll write a simple function to see if we can find a phone number within the array.     func findNumber (number: String , numbers: [ String ]) -> String {         for tempNumber in numb

Exploring SWIFT

Should have posted this a long back, but just got the perfect time to get it done.  I got a chance to develop an e-Commerce mobile application targeted at iOS8. We decided to develop it using the latest technologies, so we chose to use the SWIFT language released by Apple in Conjunction with iOS8. SWIFT is a safe, modern and powerful Language, it has a lot of interesting, time saving features, which could allow us(Developers) to focus/work more on the Application’s logic rather than the coding itself. Swift’s shorthand syntax makes us to write less code when compared to Objective C. It was a great decision to remove the semicolons(At the end of each statement), Braces (In Control Flows), Subscripts, Enumerations, etc… Some of the very interesting stuff includes: Optionals Tuples Closures Access Control Going briefly into those interesting stuff, that mostly adds value to our code/time. Optionals: The most interesting and powerful featu