WWDC 2018 | Keynote |Quick Notes | 2 mins

Screen Shot 2018-06-06 at 9.55.14 AM.png

“Today is all about Software,” Apple CEO Tim said as he took the stage at WWDC 2018.

It all started with statistics.

  • 20 million iOS developers
  • 500 million weekly app store visits
  • 81% using iOS 11 where only 8% using latest Android
  • Developers earned 100 million through App Store

 

Screen Shot 2018-06-06 at 9.50.17 AM.png

iOS

  • New iOS 12 will be released as a free update, every model back to the 5S will get a performance boost.
  • ARKit, second generation, which included a lot of cool updates, most interesting is the ability for multiple users to observe and interact with the same environment from different angles.
  • Apple Screen time, now iOS 12 will tell you how much time you’re spending with your iPhone and which are the apps.
  • Do not disturb a lot of improvements, while you are sleeping will hide the notification, one step one time notifications.
  • Photos, with iOS 12 they have revamped it. Allowing more search options driven by AI, share the photos through iMessage.
  • Siri, it’s handling 10 billion requests per month and now Apple is allowing you to interact with it more, create shortcuts to trigger app features.
  • Animojis, more personal now. It’s super accurate, face-tracking and tongue tracking capabilities. Surely it will feel you very familiar.
  • Group FaceTime, now chat with 32 people at once with emoji, sticker, and other effects support.

iOS Apps updates

  • Stocks, new UI with better performance
  • Apple News app.
  • Apple iBooks getting a redesign and a new name.
  • Voice Memos, iPad getting it for the first time and recording will be now synced to iCloud.

 

Screen Shot 2018-06-06 at 9.51.04 AM.png

watchOS

So far biggest functions of the Apple iWatch is fitness, now Apple adding more components which let you challenge your friends.

  • Automatic workout detection using your heart-beats(once you stop working out your heart rate decreases, so it will automatically stop).
  • Walkie-Talkie, Texting/phone are tough using watch screen so Apple added an instant audio messaging app called walkie-talkie (uses the wifi or cellular to interact with other devices).
  • Siri on Watch, allow third-party apps to show you more information. Now just lift your wrist and start talking it means no more “Hey Siri”.
  • Podcasts app is coming on your wrist.

 

Quick Notes | Swift classes into Objective-C Code when you have multiple targets.

How to use Swift classes into Objective Code when you have multiple targets.

For using Swift classes in Objective-C Code when you have one target in your app. We generally need to andimport TargetName-Swift.h next to add support in your Swift file you need to inherit if from NSObject or use @objc flag.

What if you have multiple targets in your codebase? As you cannot import, TargetNameA-Swift.h TargetNameB-Swift.h etc. In that case, you can tell the compiler that not to create Swift module specific to target change it to project name because the project will be same and unique.

For achieving this select your every target, Build Settings and change the build configuration.

Objective-C Generated Interface Header Name —> replace  $(SWIFT_MODULE_NAME)-Swift.h that is specific to the each target, with ​​​​$(PROJECT_NAME)-Swift.h

Screen Shot 2018-04-19 at 11.02.20 AM.png

Screen Shot 2018-04-19 at 11.02.38 AM.png

Later import PROJECT_NAME-Swift.h in your Objective C code to make use of your Swift code.

iOS Wireless Install, Debug Builds using WiFi | Quick Notes

Yes, correct you heard it right. It was the most awaited feature because nobody wants to spend a lot on Apple connectors, haha. But unfortunately, I don’t see people are utilizing this features. So here we go with one to kick start.

Prerequisites:

  1. iOS device with later or iOS 11 OS version.
  2. MacBook with macOS 10.12.4 or later.
  3. Xcode IDE with 9 or later
  4. Developer Macbook and iOS device should be on same WiFi network.

I hope after reading prerequisites you are clear about what is gonna happen. Let’s move on further steps.

Step: 1 Here you need your connector cable for first and yes last time. Connect your iOS device and open Xcode.

Step 2: Switch to,Window,Devices and Simulators options, below is the screen for reference.

Screen Shot 2018-03-28 at 10.44.58 AM.png

Step 3: Just enable the optionConnect via network.

Step 4: Sometimes it will ask you to provide your iOS device IP to enter but in my case, it didn’t ask.

Thanks for reading!

Creating and Distributing iOS Frameworks | Swift | Tips & Tricks

Why do we need to create frameworks? because it has three major purposes mentioned below and also you can share your code with your team, other developer or iOS community.

  • Code encapsulation
  • Code modularity
  • Code reuse

Let’s create the iOS framework.

Screen Shot 2018-02-05 at 8.24.50 PM

Now just give some meta-data about your framework like name, organization, identifier etc (I hope you’re already aware of it).

Screen Shot 2018-02-05 at 8.26.54 PM.png

We’re good to go till now. Just add the files that you want to keep within your framework.

add

Build the framework project to make sure that you get build succeeded with no build warnings or errors.

Things that you need to take care.

  • Make sure to check Copy items if needed, so that the files actually copy into the new project instead of just adding a reference. Frameworks need their own code, not references, to be independent.
  • Double-check that each of the files has Target Membership in ThreeRingControl to make sure they appear in the final framework. You can see this in the File Inspector for each file.
  • Double-check the access modifiers, while creating framework access modifiers plays very important roles.
  • if you’re creating Swift framework make sure you’re extending classes from NSObject otherwise it won’t reflect once you will import the framework.

Thanks for reading.

STUPID principles | Quick Notes

Recent blog: SOLID vs STUPID

STUPID principles and yes this may hurt your feeling but yes if you are following this you are writing stupid code.

Singleton

Well known design pattern, but mostly understood one as well. Like me, people are also fighting with Singleton syndrome. In that case, whenever we create a class we create it Singleton but why? That is definability not cool. Singleton also considered anti-patterns. We should think and avoid if possible because the program using Singleton are hard to test because of global state, with the global state they hide their dependencies.

Tight Coupling

Avoiding static things is important to avoid tight coupling. If it’s there then making a change in one module requires to changes another module too. Now it’s really difficult to reuse and difficult to test.

Untestability

Testing is not hard, what you think? We don’t write test case may be because we don’t have the time or the code we are writing is bad because of tight coupling?

Premature Optimization

One of my favorite quote from Donald Knuth, premature is the root of all evil. There are only cost and no benefits. Actually optimised code is much complex as compared to just writing a loop.

Indescriptive Naming

That’s what I like most and I try to follow as much as possible. Name of your class, variables or methods should be clear because at the end of the day human is only going to read because programming languages are for human not for computers, computers can understand 0 or 1 very well.

Duplication

That’s bad. Writing same code again and again so don’t repeat yourself, keep it simple and strong. Write Code only once.

Thank you for reading the quick introduction of STUPID principles, next will be SOLID principles.

SOLID principle with Swift | STUPID

SOLID principle is an acronym created by Robert C Martin also unknown as Uncle Bob. It represents five principles for OOPS.

Single responsibility
Open/Closed
Liskov Substitution
Interface Segregation
Dependency Inversion

Now the first thought that came to my mind is Why do we need this? Here is the answer, using these principles we can solve the problems of a bad architecture.

Fragility where A small change may break complete module it’s really very difficult to find this if you don’t have good test cases.

Immobility where A component is very hard to reuse in another project or we can say multiple places in the same project because of too many dependencies.

Rigidity where Single change requires lots of developer efforts because it affects several parts of the project.

Here I want to add principles will not turn a bad programmer into a good programmer you need a better judgment there. Principles have to apply with judgment and you must be smart enough to understand when to apply what.

I have also written one blog where they have mentioned one more acronym like SOLID and it’s STUPID. This may hurt your feeling but yes if you are following this you are writing stupid code.

Singleton
Tight Coupling
Untestability
Premature Optimization
Indescriptive Naming
Duplication

Thank you for reading the quick introduction, In next blogs, I will try to define all principles with Swift Code.

Signs of wrong architecture? | Quick Notes

Recently I have got one iOS Application codebase to review and it always gives a thought, where to start?

Here are the 3 important first steps for me that I always do.

find . -type f -exec wc -l {} + | sort -n

Execute the terminal command in your project location, it will give you count of number of lines, like mentioned below

3000 ./ViewControllers/DashboardVC.swift
5655 ./AppDelegate.swift

where 3000/5655 is the lines of code.

Second, I track are we using Appdelete directly?

grep -rnw . -e "UIApplication.shared"

Last, but not the least. Swift/Objective-C dependency visualizer. It creates object dependency graphs and gives you the clear picture.

Screen Shot 2017-11-22 at 5.33.12 PM

Thanks for reading. I hope it was quick and informative for you.