Thursday, November 17, 2016

Swift 3 Updates

Hey there,

I just went through the list changes in Swift3 and i'll log an abstract of those changes here.



1.) First parameter label: Now, all the function params have labels.

2.) Omitted needless words:
Some Examples from Swift2 -> Swift3:
  • UIColor.blueColor() -> UIColor.blue,
  • numbers.minElement() -> numbers.min(),
  • "Hi there".lowercaseString -> "Hi there".lowercased,
  • Similarly 'uppercased' for 'uppercaseString'


3.) UpperCamelCase has been replaced with lowerCamelCase for enums and properties:
  • NSURLRequest(URL: someURL) -> URLRequest(url: someURL)
  • NSTextAlignment.Left -> NSTextAlignment.left
  • UIInterfaceOrientationMask.Portrait -> UIInterfaceOrientationMask.portrait

4.) GCD and CoreGraphics API's are changed from C style to Swift:

GCD:
In Swift2:
"dispatch_after(dispatch_time, dispatch_get_main-queue(), {})"

In Swift3:
"DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {}"

CoreGraphics:
In Swift2:
guard let context: CGContext = UIGraphicsGetCurrentContext() else { return }
CGContextSetStrokeColorWithColor(context, UIColor.redColor().CGColor)
CGContextSetLineWidth(context, 2)
CGContextDrawPath(context, .Stroke)

In Swift3:
guard let context: CGContext = UIGraphicsGetCurrentContext() else { return }
context.strokeColor = UIColor.red().cgColor
context.lineWidth = 2
context.drawPath(mode: .Stroke)


5.) Avoid calling with class names: 
'Self' to call class methods & 'self' to call instance methods. (Previously we'd to use class name to call class methods)

6.) Class prefixes removed:
NS removed from Timer, UserDefaults, FileManager, Data, Date, Calendar, URL, URLRequest, UUID, NotificationCenter and more

7.Swift Package Manager: Official dependency manager

8.) Inline Sequences:
In Swift2: sequence(first: someView, next: { $0.superview }) { // someView, someView.superview, someView.superview.superview,... } In Swift3: for x in sequence(first: 0.1, next: { $0 * 2 }) .prefix(while: { $0 < 4 }) { // 0.1, 0.2, 0.4, 0.8, 1.6, 3.2 }

Sunday, November 6, 2016

Hybrid Mobile App Filepath Case-Sensitive Issue

I have been yearning to learn Hybrid App Development for a very long time. To get started, i wanted to be good at fundamentals in  20+years old web technology - HTML/CSS/JS. Hence, i did this course in Coursera first and then did a round of R&D for the Hybrid frameworks and decided to start with Ionic, as i found Ionic framework to be the best in the industry as far as i know. Hence, did this Ionic course in Udemy, which is good starter for programmers. 
Enough of my story. 
Jumping into the context; After finishing up the course(not really finished, just watched the On-Demand videos as usual), i tried to create an app during which i faced an issue which was very weird, i.e., everything was working fine on the browser, but it wasn't working on the actual mobile devices, both iOS & Android, which were supposed to be the target devices. 
First, the catch i made was that the issue was consistent on both (iOS&Android) these devices, so definitely its not an OS specific issue. 
Next, i tried to print logs around all the code where the issue was producing and found that  one specific library(randomColor.js) was the cause of the issue, which was added at last (as far as i remembered), so i put logs around the code used in my JS file which were printed in the device console and noticed that none of my code written after that library's code was getting executed. 
To confirm that the randomColor.js is the cause, i just commented out all the library related code from my JS file & everything was working fine on all the devices, so the culprit was that library. Now, i wanted to find out if the issue was in my code or in the lib code. I saw that the lib had hundreds of stars & active contributors, so there's less chance of having any such critical issue left out in the prod version. 
So, finally, i decided to check the lib integration process from the start again & found out that a very minor mistake i did was the ROOT Cause of this major issue. 
The issue was that there was a case-sensitive file name typo i made in the import statement in my "index.html" file. 
This was the path of "randomColor.js" file in my project:
"Lib/randomcolor/randomColor.js"
But, i imported this lib in "index.html", like this:
"Lib/randomColor/randomColor.js"

Did you notice?
Yes, that Su**ing CAPITAL 'C' (Have marked in Bold above) was the culprit. 

Since, browsers does case-insensitive search for JS files, whereas both the native mobile platforms does case-sensitive file search, hence i was faced with the issue after integrating "randomColor.js" with typo in file import code. 

It might not be a very big issue, but it wasted a lot of my time, hence thought of logging it here, thus hoping to save someone else time with this crap. 

Thanks for taking out your time to read my stuff. 😊

Monday, June 13, 2016

Apple’s WWDC 2016 Summary

Apple’s WWDC 2016 Summary:


iOS:
iOS 10 - 
* New Home app with HomeKit support to control all the smart home devices.
* Game Centre being ditched away. GameKit to be introduced to replace it.
* Stocks, Compass and other unused pre-installed apps can be deleted now.
* Interactive Lock Screen.
* 3D to interact with apps w/o unlocking phone.
* App widgets with 3D touch.
* Raise to wake feature w/o having to unlock the screen.
* VoIP apps can create extensions and integrate into Phone App.

OS X:
* OS X renamed to macOS and the new next OS named “macOS Seirra”.
* Auto-Unlock when you are near the mac with phone/watch.
* Siri Integration(Search files, play music, send messages, search the web)
* Apple Pay Integration
* Universal Clipboard (That could be used to copy/paste across Apple devices)
* Picture In Picture (PIP) view(You can watch video in a separate box while you browse)

Apple tvOS:
* DarkMode
* Single SignOn
* Auto-syncing of apps b/w iPhone & TV
* iPhone can be used as a Remote now.

WatchOS3:
* Instant Apps Launch 
* Scribble (Send messages by hand written letter-by-letter on the watch screen)

Siri Upgrades:
* Voice mail transcription
* Image search
* Opened up to 3rd party developers

iMessage:
* Invisible ink(Message is visible only when the screen is swiped)
* Replace words with Emoji in a Single Tap
* Access given to 3rd party developers (For Transactions, Services, bots)

Photos App:
* Gets/Copies more updates from Google Photos.
* Creates Movies/Moments from the library.

Apple Maps App:
* Checks for locations from Calendar app.
* Checks for places close to you.

Compatible Devices:
* From iPhone5.
* From iPad Air & iPad mini 2.
* From iPod Touch 6th gen onwards.
Devices being removed from last update are:
iPhone4s, iPad 2/3, iPad mini

QuickType Updates:
Offers relevant contact info, location details, and other intelligent suggestions.

Other Updates:
* There 2million apps in Apple’s app store and downloaded 130billion times.
* Apple Pay comes to web with authentication from iPhone/iWatch
* Swift Playground App (To make everyone learn Swift)
Xcode8 with Swift3

Search Ads:
You can advertise your apps in the App Store apps now.

App Subscriptions:
* Any app can opt for In-App Subscriptions.
* With new policy, any app that has crossed an year will have the benefit of 85/15 share, despite the standard 70/30 revenue share.

Sunday, May 29, 2016

Android from iOS Guy's Perspective

I got a chance to learn Android Development through this course on Udemy, which is very good for freshers or even noobs like me or the one with literally no experience Programming at all.

I have just completed it (Believe me: I have listened and followed all the videos and have experimented all those fundamental/basic codes ;) ) and wanted to share my experience with this MOOC.
I believe that MOOC will vanish the standard academic learning in the coming days.

Since, i have been doing only iOS apps for a very long time, being basically an iOS dev, the perspective of this post comes from that point of view.

So, here goes my thoughts on the Android Eco system at first:
I haven't really been an avid Android user, since i haven't owned a phone yet, but i would have to admit that it really was a wonderful experience throughout the course learning and knowing about the  Eco system itself.

Before going into the course, i would like to thank the Udemy team and the 3 authors of the course who have put up their valuable time in bringing up this course for developers at any level. Else it would have taken still more time for people like me to get to know about Android. ( I know its late even now ;) )

I believe that Android Native Development is handy when someone is comfortable enough with coding in Java. Anyone with experience in working with any Object Oriented programming language would find it easier to adopt as well.
Myself hailing from the Objective-C & Swift background and iOS world, what i actually wanted to know was the differences between iOS & Android SDK's and how the system(API's) interacts with the OS. Knowing that i could easily get comfortable working with the platform.
Although, Android is said to be a copied & evolved version of iOS, i believe that it had a burst in advancement due to its Open Source nature, which is a Good as well as a bad thing. But, lets leave that topic aside, which is not the goal of this post.

For anyone from iOS world, trying to learn Android, i think that they would have to start with using the Android phones first(Which i did for a couple of months, not specifically to just learn it), then follow the Udemy course, which is very good for even very beginners, just like me.

I also believe that getting to know about the difference between both the platforms before hand would help to speed up the learning process.
Hence, i have listed out the Android counterparts of the UI, Classes, API's and others below.
I also believe that the differences listed should also help Android guys who haven't been into iOS yet to figure out what it would take to jump into the platform.


Below are major differences:

OS perspective:





SDK/Tools Differences:







Thursday, March 3, 2016

iOS9 Features

Adding it lately, but still feel like doing it.


Here's the rough overview/summary of what has been added into iOS9:
  • An All New App Switcher (From left to right. Placed like a deck of cards).
  • Contact guesses from Mail in Call Screen.
  • Bottom scroll to navigate quickly through Photos.
  • Contact thumbnails in Messages.
  • Notifications view by Recent.
  • New screen for Spotlight with Siri Suggestions and Contacts search.
  • Plugging in the earbuds would bring up the Music controls on the Lock screen.
  • Accessing the iCloud Drive app.
  • Low Power Mode.
  • Automatically organise Selfies, Screenshots in Photos app.
  • New San Francisco Font.
  • Shift Key (To differentiate b/w Caps/Lower cases).
  • Back button on status bar to go back to the previous app.
  • Notes (Sheet/popup) option from Share sheet.
  • Search in Settings.
  • Public transit in maps.
  • Hands off.
  • 6-Digits Passcode.
  • 1.3GB OS (As oppose to 4.58GB iOS8.0)
  • Xcode7 allows to install app on device w/o paying/subscribing for Apple’s Developer Program.
  • iPad Features:
  • Multitasking (Supports Slide Over, Split View, Picture in Picture).
  • Hold 2 fingers on keyboard to make it a trackpad to select the sentences.

Developer’s Perspective:
  • App Thinning (App Slicing, On Demand Resources, Bitcode).
  • Search Extensibility (Search content within apps).
  • SFSafariViewController.
  • UIStackView.
  • 3D Touch (Pop & Peek).
  • Gameplay Kit
  • Replay Kit

Watch OS2.0:
  • Native apps.