Announced in 2014, the Swift programming language has quickly become one of the fastest growing languages in history. Swift makes it easy to write software that is incredibly fast and safe by design.
Blog for developers to highlight, top 10 trending open source to learn.
- MessageViewController A SlackViewController replacement written in Swift, compatible with iPhone X, iOS12. Created by Ryan Nystrom
- Swift interpreter for Pascal language (Inspired from Ruslan’s Blog). Created by Igor Kulman
- CollectionViewSlantedLayout subclass of the UICollectionViewLayout allowing the display of slanted cells in a UICollectionView.Created by Yassir Barchi
- Mint Package manager that installs and runs Swift command line tools, created by Yonas Kolb
- CryptoSwift Collection of standard and secure cryptographic algorithms implemented in Swift. Created by Marcin Krzyzanowski
- CocoaDebug Debugger tools for iOS supports Swift and Objective C, created by CocoaDebug
- iOS-Depth-Sampler Examples of Depth APIs in iOS, created by Shuichi Tsutsumi
- Universal Link Testing It fetches and parses apple-app-site-association file for you to quickly check whether Universal Links are working. created by Ethan Huang
- Swift Syntax Set of Swift bindings for the libSyntax library. It allows for Swift tools to parse, inspect, generate, and transform Swift source code. Created by Apple
- WhatsNewKit Showcase your awesome new app features, Created by Sven Tiigi
Thanks for reading!
What are the Design and Architecture?
The design is more often seems to when it comes to structures and low-level decisions whereas Architecture is often used in the context of something at the high level where we can see how components are connected with each other. But for starters, there is no different at all.
What is the GOAL of good software design?
The goal of software architecture is to minimize the Human Resources required to build and maintain the required system (By Uncle Bob Martin)
Basic fundamentals measure the design?
The measure of design quality is simply the measure of the effort required to meet the needs of the customer if the effort is low and stays same through the lifetime, System design is good else it’s bad.
The Signature of a system design mess?
- Developer point of view
The graph says developers started with nearly 100% of productivity but with each release, their productivity going down
- Executive point of view?
Release 1 was delivered with a few hundred thousand payrolls and by the time of 5 release, it’s going to touch $500,000.
What is going wrong?
The moral of the story says everything in one line: “Slow and steady wins the race”. Yes, it all because of overconfidence. Everyone wants to hit the market first or release the app asap with the statement “We can clean it up later” and they can’t go back for cleaning the things up because now we have the new feature, new release so maybe next time, next time and next time.
The only way to go fast is to go well.
To take the software architecture seriously we have to think and need to know what good software architecture is, compare the different architecture with the requirements.
Thanks for reading it, if you want to read in more detail, buy “Clean Architecture by Robert C. Martin”
image source (google.com)
Let’s say you work as a company secretary and your job is to take the phone calls, manage meetings etc. Every time the phone rings, you have to stop whatever you are doing. A property of a program that allows tasks to run in overlapping time periods.
- Parallelism, allows 2 or more tasks to run at the same time (Only if the machine has the multiprocessing capability). You asked your boss and he hired a clerk for taking the call. It looks very simple but concurrency introduces a few problems like the Race condition,
- Race Condition, Suppose you have $500 in your bank account, at the same time when you withdraw $200 someone transferred $300 or maybe in simple words same time 2 transaction happened for withdrawing $500.
- Mutual Exclusion (Mutex), Solution for the Race condition. Now, whenever some transaction starts it locks the account. if some transaction is going on with your account you cannot withdraw. But next problem is nobody wants to wait every time when there’s is something going on. Semaphore is the modified solution for Mutex.
- Semaphore (Improper use of Semaphore will give improper results)
- Binary Semaphore (Range is from 0 to 1), Idea is to give specific priority to different types of transaction. Withdraw request has a higher priority than bank transfer. So when you withdraw, another transaction for transfer will stop and it will resume once withdraw is completed. (As simple as that, 1 = ongoing transaction, 0 = waiting) Also known as integer semaphore.
- Counting Semaphore (Range is from -∞ to +∞), Allow more than one process running at the same time. Let’s suppose you’re a key room manager where you have 30 keys if lockers are full users have to wait in the queue. when someone has done they will hand over the key to the first person in the queue.
- Deadlock, Another common issue in concurrency modal. Let’s assume user a transferred amount to b and at the same time user b transfer the amount to the user a. both transactions are waiting to complete another one as they can’t access the locked account.
- Structs are the value type.
- Classes are the reference type.
- Properties of a constant instance of the struct are immutable because struct’s instance own the whole object and by declaring it as a constant means the whole object itself will be immutable.
- Properties of a constant instance of the class are mutable as class’s instance owns the object’s reference thus by declaring it as a constant only means that the further reference assignment can’t be done.
- Structs are blessed with default member-wise initializer but classes are not.
- Structs are preferable when they are small and copyable.
- With Structs, there is much less need to worry about memory leaks or multiple threads racing to access/modify a single instance of a variable.
- Since struct instances are allocated on the stack, and class instances are allocated on the heap, structs can sometimes be drastically faster (but it still depends on how many values you’re storing and the size/structure.)
- In a multi-threaded environment, for instance, with a database connection that’s opened in a different thread, structs are safer. They can be copied from one thread to another thread, without running the risk of a race condition or deadlock. Classes do not have this inherent safety unless they’re deliberately made thread-safe.
Thanks a lot for reading it.
“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
- 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.
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.
Problem-solving requires two types of mental skills, analytical and creative. I know this sounds very high level So let’s talk about the basic fundamentals what generally I try to follow in day to day professional and personal activities.
- Listen carefully You need to pay very close attention to any information in the problem description. The optimal solution for a sorted vs unsorted array will be totally different so don’t miss anything.
- Brute Force Yes correct, Get the brute force solution as soon as possible, don’t think about the optimal solution. I always catch the first thought that comes to my mind. Don’t think about code, the algorithm just rough idea.
- Optimize Now it’s time to work on your Brute Force with some BUD (Bottlenecks, Unnecessary work and last Duplicated work) techniques.
- Remove the unused information.
- Solve it manually on paper with an example.
- Reverse engineer your thought process. HOW DID YOU DO?
- Make a Time VS Space trade-off. CAN YOU REDUCE-IT MORE?
- Implement Congratulations now you have an optimal solution on paper. The last goal is to write beautiful, modularize code.
If you are trying to solve the problem in interview KEEP TALKING because your interviewer wants to hear how you’re going to approach the problem and it will make the interview more interactive.
Thanks a lot for reading the quick-notes!
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 and
import TargetName-Swift.h next to add support in your Swift file you need to inherit if from
NSObject or use
What if you have multiple targets in your codebase? As you cannot import,
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
Later import PROJECT_NAME-Swift.h in your Objective C code to make use of your Swift code.
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.
iOS device with later or
iOS 11 OS version.
- MacBook with
macOS 10.12.4 or later.
Xcode IDE with 9 or later
- 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,
Devices and Simulators options, below is the screen for reference.
Step 3: Just enable the option
Connect 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!
Lots of developers consulted with me regarding on how to use storyboard with too many team members like when you have 20 developers on your team? So I have collected my thoughts on that today. I have used Storyboard as well as XIB so here are my thoughts on both.
- Storyboards are the really nice way to see complete application flow without running into Simulator, you can see the screen flow and the navigation between them, it’s one of key thing that makes your application architecture better.
- For a larger team of multiple developers it’s really difficult to use the same storyboard because at the end it’s XML file so really very hard to merge and you will end up with a lot of conflicts, So I have noted, a lot of developers suggest XIB here but I don’t see any reason why they choose XIB and I think the best idea is the divide the complete application in different storyboard according to their use-case, that is the first activity I always do, divide complete app into as much as possible storyboard you can (but it’s not like 1 storyboard for 1 ViewController) and use storyboard reference to connect them.
- I worked in rapid prototype development (deliver the complete application in 15-20 days, developed POC in 7 days) so the biggest benefit that I earned from storyboard is Mock-up, I can create complete app mock-up without writing a single line of code and really easy to manage the transition between views.
- Few issues that I feel with the storyboard is, it fails at runtime means if you made a mistake with segue name, the class doesn’t exist etc. Yes, it gives issue at compile as well only if you didn’t merge it properly (merge conflicts with XML tags).
- Using Storyboard, no need to run your app on the different simulator to verify the UI, it gives you fantastic feature called preview (Click on the Assistant editor, select your storyboard, choose automation to preview).
- Developers say it’s harder to reuse the code in storyboard but my opinion is, first think and implement, try to use mix approach with the storyboard, XIB (wherever requires use XIB to make it reusable on different storyboards).
- Yes, storyboard creates an issue when you create one in Xcode 8 and try to open it in Xcode 7 but lots of developers already raised this concern with Apple so hopefully, we will hear something from Apple soon.
Thank you for reading! Please do share your thoughts if any.
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.
Now just give some meta-data about your framework like name, organization, identifier etc (I hope you’re already aware of it).
We’re good to go till now. Just add the files that you want to keep within your framework.
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.