1. Introduction:
MVVM is an abbreviation of Model View ViewModel. A Model-View-ViewModel is software architectural pattern that was created way back in 2005 by John Gossman. MVVM is quite similar to MVC, but it provides better connect of the UI and business sense than that of MVC. In MVVM pattern, each view on the screen will be backed by a view model and it represents the data for the view.
2. MVVM flow Layout & Theoretical Background:
In an MVC-based project, View is Connecting with its ViewController. ViewController is easily overloaded and increases its size when the application becomes bigger. So ViewController is affected in MVC. This drawback Solution in MVVM pattern.
MVVM Data flow shown in Below Fig 1.
As per above figure, the three core components of MVVM model respectively are,
1. As per above figure, the three core components of MVVM model respectively are,
2. Model: it is class that holds our App Data.
3. View/ViewController: it presents our View and ViewController Class.
4. ViewModel: ViewModel binds the Model and ViewController, it’s the heart of MVVM design pattern. It provides the connection between the model class and the view/view controller. View Model is capable of observing changes in Model and synchronize itself with the events.
Example:
Let’s start Understanding MVVM Design pattern with a simple example.
First, create a project in Xcode. Also, create Model and ViewModel Class. In this project, we have taken tableView and shown employee name and its department using MVVM design pattern.
Model:
Shown model class in below Fig 2. In model class, we have defined variable and function, as per our requirement.
View-Model:
– In View-Model Class we have taken a Model object, so we have used – Model class property in View- Model Class. In our project model Employee is a model object.
– Here Model and View-Model class are connecting to each other.
– Shown View-Model Class in Fig. 3
View (Controller):
– First, take View-Model object in ViewController Class. myViewModel is View-Model object. In our project, we have taken table view.
– In this class, View-Model and View-Controller are connecting to each other. View-model object through, we get all data of View-Model class as per requirement.
– View (Controller) class shown in Fig. 4.
Also shown Output in fig. 5
Advantages:
– Code reuse: In View-Model class we implement init, setup and view presentation method, so we use this functionality in each new view controller.
– Improved Testability: In MVVM we can make all classes separate so we can easily find an error.
– Reduce code size
Disadvantages:
– MVVM pattern not useful for single View application, when we work on Multiple views then it is useful.
Conclusion:
MVC and MVVM both patterns are useful for iOS app development. MVVM is new Concept for the design pattern. MVVM is more useful when app size is bigger because the separation of Model, View and View-Model class can reduce complexity.
Eagerly waiting for the features of Xcode 9? Here it is. Apple has released Xcode 9, the newest version of its free integrated development environment (IDE) for building iOS application, macOS, watchOS, and tvOS apps.
With everything you need to create amazing apps for Apple platforms, Xcode 9 is unbelievably quick and consistently smooth while editing even the largest files. It also understands your code better than ever. Powerful new refactoring tasks happen in place, renaming symbols across Swift, Objective-C, and even user interface files without skipping a beat. And with source compatibility in Swift 4, Xcode 9 uses the same compiler to build existing Swift 3 code and updated Swift 4 code, so you can migrate at your own pace.
Brief About Xcode 9
All New Editor
Xcode 9 has a brand new Source Editor, entirely written in Swift. In the new editor you can use the Fix interface to fix multiple issues at once. Also, when mousing around your projects, you can hold the Command key and visually see how structures in your code are organized.
The source code editor has been completely rebuilt for amazing speed. It scrolls at a constantly smooth rate, no matter the files size. And it looks better, too, with preferences that give you greater control over line spacing, multiple font styles, and even the type of cursor. Issues have been redesigned to flow nicely with your code with Fix-its that are grouped together so you can commit multiple changes in a single click.
You can now increase and decrease the source editor font using ⌘ with + and ⌘ with -. When text is selected, typing an opening delimiter adds a matching closing delimiter at the end of the selection.
Refactor and Transform
The new editor goes beyond text entry with a new built-in refactoring and transformation engine. When you select a symbol or block of code, the editor will offer powerful operations such as ‘Extract’ or ‘Rename.’
One of the most basic refactorings is to rename a class, and all references to that class in the project are renamed as well, including references in the Storyboard and the filename itself.
Xcode 9 supports the following transformations and refactorings:
Project Navigator
Groups in the Project Navigator are now more closely associated with directories in the file system.
Source Control and GitHub
Xcode 9 now connects easily with your GitHub account making it very easy to see a list of your existing projects, clone projects, manage branches, use tags, and work with remotes.
With your GitHub account built into Xcode, the clone window shows all of your personal GitHub repositories, as well as all the repositories where you added a star. From this window, you can search all of GitHub and check out a project with just a click.
Swift 4
Debugging
Faster
A new indexing engine runs as part of the build process, so Xcode understands your code automatically.
Searching large projects feels quick – up to 50 times faster. And a new build system dramatically lowers the overhead of tasks that coordinates compiler, linker, and other tools.
Simulators
Conclusion
With Xcode 9 and Xcode Server, we have almost everything in single place used to create apps for Apple TV, Apple Watch, iPad, iPhone, and Mac.
As we know and experienced that no softwares can be complete or can be in a finished version, there are many new great features included in this version of Xcode. So we should definitely go for it and experience it.
We, as a mobile app developer believe that using Xcode 9, development can be done faster and can be pushed ahead with the next strides.
In this article, we, 9series, have covered about what is new in Xcode 9. If you find any new features or might have experienced with existing one then feel free to share your own experience with us.
Welcome to the next level of insights about WatchOS. If you are new to this WatchOS series then please read our blog Fundamental Concept of WatchOS.
In this article, we will look about data sharing methods across Apple Watch and iOS app. Also we will check for background tasks, Apple Pay Enhancement, WatchOS Connectivity framework, What’s new in WatchOS 3.0, etc.
So, let’s start with further more features and updates for WatchOS:
Different Methods of Sharing Data Between WatchKit and iOS App
What’s New in WatchOS 3.0
With the upcoming WatchOS 3 update to all Apple Watch devices, the performance of many watch applications is definitely going to improve. This is mainly due to the new forms of background execution where watchOS apps can take advantage in order to refresh their content periodically and always have the latest information that is ready to be viewed by the user.
1. Background Task
Background tasks give your app time to keep running out of sight and ensure that the information user needs is accessible before they open your app. WatchOS 3 introduces several types of background tasks:
Background App Refresh
Utilize the WKApplicationRefreshBackgroundTask class to update your app’s status in the background. You frequently use a background app refresh task to manage other tasks. For example, you might use a background app refresh task to start an NSURLSession background transfer or to schedule a background snapshot refresh task.
2. Apple Pay Enhancement
In WatchOS 3, the PassKit framework (PassKit.framework) includes support for in-app payments on Apple Watch. In-app payments enable users to securely provide payment and contact information to pay for physical goods and services.
3. Watch Connectivity Framework Enhancements
The WatchConnectivity framework introduced in WatchOS 2 and iOS 9 is likewise increasing some new functionality with WatchOS 3 and iOS 10.
If a user has placed your app’s complexity on their watch face, then you can transfer data from the phone to the watch up to 50 times in a single day. But while transferring, if the data goes beyond the limit of 50, then the user will get notifications about the exceeded limit. This is done, as in iOS 9 and WatchOS 2, via the WCSession transferCurrentComplication(userInfo:) instance method. The new functionality in watchOS 3 and iOS 10 is the WCSession remainingComplicationUserInfoTransfers property, which will show you how many transfers are left for that day.
Another new WCSession property added is the hasContentPending property, which is just a boolean value signifying whether or not there is data yet to be transferred between the iPhone and Apple Watch.
4. Existing Frameworks now available in WatchOS
5. SnapShot and Dock
In WatchOS 3, app sights have been removed entirely from the Apple Watch and instead have been displaced by the dock, which provides a rapid way for users to view and launch their favorite apps. After pressing the side button to show the Dock, users scroll through it to view snapshots of their favorite apps. When users stop scrolling and let the Dock settle for a moment, the promoted app wakes and the snapshot gets replaced by the running app.
The system automatically takes periodic snapshots of your app and uses them to populate the Dock and to serve as your app’s launch image. You can modify both the currently presented interface controller & the controller’s content before the snapshot is taken.
6. Control Center
Provides support for all-new Control Center which can be invoked by sliding up from the bottom of the screen.
7. New Watch Faces
Adds new watch faces and adds support for switching between them by swiping left/right from the edge of the watch screen.
8. Activity/Workouts
Adds support for sharing an activity with friends using iMessage or other messaging platforms.
Adds support for tracking the progress of people in wheelchairs, showing a “Time to Roll” reminder rather than “Time to Walk” as watchOS 2 did. It is now conceivable to see 5 different workout metrics all at once. This includes distance, pace, active calories, heart rate, and elapsed time. Adds support for delaying a workout when halted at a stoplight. Support for another Breathe app guides users through a set of deep breaths to help them be more comfortable.
9. SOS
Adds support for a feature called SOS which allows a person to place emergency calls by holding the side button for 5 seconds.
Give us a chance to check with some convenient question-answers.
FAQ
1. How many Apple Watch can I pair with one iPhone?
2. What is the maximum size for WatchKit App?
3. Can I play video on Watch App?
4. Can I fetch contact in WatchKit app?
A debt of gratitude is in order for your opportunity to peruse this article and constantly running over our blog. We trust you appreciated next level of insights about Watch OS shared by our best iOS application developers in USA. Stay tuned with us for more technical and advanced articles.
Feel free to share your queries, thoughts or focuses on “[email protected]”.
Today, in the world of the online market, the mobile app is king. The processing power of devices and smartphones based on iOS, Android, and other mobile operating systems merged with the speed of broadband cellular networks have led to more mobile apps. Enterprises can’t be considered secured, without securing their mobile applications.
In the current market of mobile application development, security is a key aspect of application development. Consider a mobile application which deals with user’s information and communicates with a remote server to transfer data.
Mobile devices may transfer data from safe networks to untrusted, dangerous networks seamlessly. By uniformly changing wireless networks, such as Bluetooth, Wi-Fi, CDMA, GSM and Near Field Communication, devices are extremely sensitive to being exploited. Hackers can hijack sessions via tampering and sniffing. Hijacking allows illegal access to stored data, cookies, passwords, VPN credentials and certificates. It indicates that the hacker now has the complete privileges of the device’s owner and has the ability to disguise as the application’s user, while in some circumstances, gives the keys to the enterprise. We are ready to help you discuss the security and safety of your mobile apps.
Our iOS developers follow below steps to deliver robust and fully secured applications to our potential clients.
1. Storing of Application Data
2. Network Communication
3. User’s Sensitive Information
The above points are explained in details one by one as:
1. Storing of Application Data
2. Network Communication
3. User’s Sensitive Information
Hence, security is the key aspect of any mobile application which we are taking care of. Because the information which may be unimportant to us, but those are important to our end user. If you have any queries or point to discuss, feel free to contact us on “[email protected]” and get your app developed with better security.
Happy Secure Application Development
You have opened a business, and you got a few customers with a reference or without reference. The owners themselves know that there wouldn’t be a steady footprint of customers in the coming days because there are competitors and they would eat the shares. The majority of business owners faces few common questions such as “How can I have more customers? How can I make my business steady? How can I grow my business to the next level?”. Here, the most important thing is to get the name out there. Either your customer does it for you or you yourself. When you want to do it for yourself, it’s all about marketing & advertising.
“Creating ideas and building brands that truly matter to people” – Leo Burnett
Well, at this stage you may be having a next question “what type of advertisement I should go for?”. There are following major options available for the advertising your products or services
1. Print Media such as Newspaper, Magazine, etc.
2. Digital Media such as Television, Radio, etc.
3. Online Marketing such as Advertising via Social Media, Search Engines, Prominent Website, Mobile Apps, etc.
The first two options are very costly compared to the third one, and it may be out of range for your business. The third option may fit into your business as it is cost effective and works well in this digital world. In this article, our main focus is to concentrate on online advertising that covers website and mobile apps.
At present, there are many third-party online advertising tools such as Adsense, AdMob, Mobclix, etc.
But, have you thought of having your own customized advertisement engine? We have seen that there are organization and businesses having a good number of customers using their mobile apps and websites, but those businesses are still using third party advertising services. Isn’t it a loss to the business in a long run? You can imagine the benefits of having your own customized advertisement engine to cater the need of vendors.
At 9series, have created advertisement engine that is very customized, optimized and full-fills almost all kinds of advertisement need of a business.
This ad engine supports number of advertising possibilities, such as
1. Banner Advertisement: Will display ad banners on screen.
2. Link Advertisement: This will redirect to the ad provider website in an in-app browser.
3. Video Advertisement: This will play a video about the ad.
4. Seeded Advertisement: Ad between then loaded a list of data.
5. Ads based on preference: Ad related to user’s interests.
6. Ads based on user’s actions: User purchase deal and will get an ad related to similar things.
7. Location-based Ads: As a name, self-explained.
This ad engine is modularized in iOS and Android code & API by functionality. It is reusable, handy and has the capabilities similar to the popular ad servers available at present in the market. On top of that, you can get the facilities as per your need and customize it as per your business need. Expert Android developers and iOS developers can play a very important role for you who have little experience or knowledge of advertisement industry.
You may be having a question about caching of data. Here, we have taken care of it, the algorithm is designed in such a way that it doesn’t only cache advertisements locally but also displays it as when required. This will reduce the usage of bandwidth as well as API interactivity.
The backend will store all preferences of users with cached data. Execute advertise algorithm in an optimized way and serve it securely.
Some quick examples on how it will work for your advertising clients on your products/software
1.The user is near to restaurant area -> Ad engine will serve ads related to food of that restaurant.
2. The user is on sports ground -> Ad engine will serve ads related to sports equipment, fitness equipment, etc.
3. The user is interested in entertainment -> Ad engine will serve deals related to food, movie, fun programs.
4. The user is moving inside the mall -> Ad engine will provide ads related to nearby offers, shopping, etc.
Don’t like video ads? Fine. Just set “Off” for video from preference and it will not serve it.
What about rewards?
The reward is also there based on advertisement view. Ultimately user will also gain points if he or she will review the advertisement. Either user is viewing linked advertisement or clicked in seeded advertisement, or view entire video of the deal, then he will earn points which he or she can redeem accordingly.
Everything is not covered in this article, however, if you are interested to know more, please feel free to write us at [email protected]. Thanks for your time to read this article.
Apple’s WWDC (World Wide Developer’s Conference) was held on June 13-17. Each year, over 5,000 iOS developers from around the world gather to learn more about the new releases in iOS, OS X, watchOS, and tvOS.
Earlier this week, Apple officially kicked off their annual WWDC event in San Francisco. WWDC was like Christmas for Apple developers.
As always, the event began with a keynote during which Apple announced updates for their iOS, OS X, watchOS, and tvOS platforms.
Although we haven’t had time to go through all the docs and samples yet, but we thought it might be useful to post some of our experience of new releases:
iOS 10
Big. Bold. Beautiful
Everything you love is now even better with iOS 10.
1. SiriKit
Now there is the ability to integrate with Siri.
SiriKit defines six distinct domains that an app can use to make services available to Siri:
If an app falls into one of the above listed domains, we should provide an Intents Extension point within an app. Siri deals with all of the nuances of language processing and semantic analysis, and translates the user’s request into an actionable item that we handle in our Intents Extension.
Want to dig more: Introduction to SiriKit
2. iMessage Apps
In the keynote, Apple demonstrated a ton of cool new features like link/media unfurling, reactions, message bubble effects. With the new Message framework, it creates extensions that let users send text, stickers, media, files and most intriguing: interactive messages.
Sticker Packs
The simplest type of extension is sticker packs.
Interactive Experiences
The APIs allow to create an entire experience right within the Messages app, even provide a custom user interface!
Want to dig more: API Reference
3. User Notifications
A new User Notifications UI framework has been introduced that allows developers to create rich notifications which was never possible before.
For example, notifications can now have embedded media much like the stock Messages app.
Note:
This is achieved through a new extension that is invoked when a notification is received and looks to be extremely powerful.
Want to dig more: User Notification
4. Security
Apple’s war for encryption continued at the 2016 WWDC event in San Francisco. Apple announced that it will require all iOS apps to use HTTPS connections by January 1, 2017. Apple will require all apps to enforce ATS, which will force the connections to HTTPS instead of HTTP.
Note:
HTTPS is simply the secure version of HTTP (Hypertext Transfer Protocol), the protocol for data communication online.
1. Apple will require all iOS apps using HTTPS connections before 2017, increasing security and privacy for mobile users.
2. The requirement comes through an enabling of ATS (App Transport Security), an iOS 9 feature that is currently not mandatory.
3. Apple is forcing the use of ATS/HTTPS marks a definitive shift in the company’s battle for encryption, and could win an audience with the privacy-conscious
Swift 3
Swifty
The important announcement of this year’s WWDC keynote was, without a doubt, the introduction of Swift 3.
The change from this year will have the biggest impact on developers due to the release of Swift 3 in late 2016, since it will require us to all make some major changes to our Swift code.
Swift 3 is conveniently packaged with Xcode 8, side-by-side with Swift 2.3. One of the biggest changes coming with Swift 3 is that, Swift 3 version is much more concise, and makes use of an enum to make it more “swifty”.
Lets check an example of working with strings:
// Swift 2.2
let content = txtDescription.text.stringByTrimmingCharactersInSet (NSCharacterSet.whitespaceAndNewlineCharacterSet())
// Swift 3
let content = txtDescription.text.trimming(.whitespace And Newlines)
The goal is to reduce verbosity in naming to make expressive code. In the long run it will make the language cleaner and more approachable for new developers.
Swift Playgrounds
Learn serious code on your iPad. In a seriously fun way.
Want to dig more: Swift API Design Guidelines,Github Swift Evolution
Xcode 8
It wouldn’t be WWDC without an update to Xcode!
Compare to last year, we were unable to use Xcode 7 unless migrates our source code to Swift 2. Xcode 8 provides a migration tool to convert existing code to Swift 3, which makes things much easier. It combines both Swift 2.3 (Source compatible with Swift 2.2) and Swift 3.
Feature of Xcode 8
1. Memory Debugger: This is a built-in tool that lets view the entire memory object graph of running application, so you can quickly isolate leaks and circular references. Even more, the new memory debugger can automatically detect memory leaks and help to quickly diagnose the problem.
2. Interface Builder Improvement: Have you ever tried zooming out in Interface Builder, then tried to drag in a button, and realized that you couldn’t unless you were at 100% zoom level? Interface Builder in Xcode 8 now allows to edit scenes at any zoom level.
3. Source Code Editing: Create own Source Code Editor Extensions to customize the coding experience. There is a new Xcode template to get started with, and when you’re finished, can distribute extensions via the Mac App Store or as a Developer ID signed binary through any other medium.
4. Performance Improvement:Apple claims that Xcode 8 is radically faster in several categories – for example Indexing Tests can be up to 50 times faster.
MacOS Sierra
What can your Mac do now? Just ask.
Goodbye, OS X. Hello, MacOS. After 15 years, OS X has been renamed to MacOS to better align with the other three platform names. The latest version of MacOS is MacOS Sierra.
MacOS Sierra helps to rediscover best photos, shop more securely online, and work more seamlessly between devices.
1. Siri
Siri makes its debut on Mac, with new capabilities designed just for the desktop. The handy features of Siri on iOS are now on Mac, along with brand-new ways to help with the things you do every day on your desktop.
2. Apple Pay for the Web
The web, now accepting the easiest and safest way to pay. This is huge for any developers working on a website with eCommerce.
Want to dig more: Apple Pay js
3. Apple File System (APFS)
Apple has announced an entirely new file system!
The current file system used by default, is HFS+ which was released in 1998 when floppy disks were still a thing. Today, most – I am looking at you base model iMac with your 5400RPM HDD – new systems include fast Flash based SSDs. The Apple File System was designed with Flash/SSD in mind and built with native encryption.
Cloning provides the ability to create instant “copies” of files and directories that cost nothing in disk space. Due to the copy-on-write behavior the cloned files and directories are not actually copied unless modifications are made. The snapshotting ability allows the system to create a read-only instance of the data so that it can be efficiently restored to a given point in time.
4. Photos
Rediscover memories in beautiful new ways.
5. Universal Clipboard
Copy on one device. Paste on another.
6. iCloud Drive
Your Desktop and Documents folder. Accessible on all your devices.
7. Optimized Storage
When you need more space, let your Mac find it for you.
watchOS 3
Feels like a whole new watch.
It’s a common opinion that the Apple Watch platform has been a bit of a flop with regard to app development. It has been missing something since the beginning: speed. Launching apps on the watch is simply painful. In this keynote, the main focus was making apps launch instantly.
1. Speed Enhancement
The big things behind the speed enhancements of the watch is the introduction of Snapshots, the Dock, and Background Tasks. The three of these combined allow watch apps to stay up to date and available to the user at a moment’s notice.
2. SceneKit and SpriteKit Availability
You can now utilize both SceneKit and SpriteKit in the watch apps. At first mention it looks like just for games, but Apple explained another use case: creating nice custom animations for regular apps as well. The current limitations of UIKit on the watch prevent developers from creating custom animations. But with watchOS 3, you can add live 3D rendered content to an apps using .scn files bundled with resources, or can opt to create interactive 2D animations with bundled .sks files.
Business travelers in emergencies will be able use the SOS feature to connect to 911 and get notifications and GPS coordinates sent to their emergency contacts. It works in different countries as well, so you don’t have to remember different emergency numbers.
tvOS
The updates to the tvOS SDK seem pretty light.
Single Sign-On
There is a new concept of single sign-on for TV providers so that users can authenticate with their provider once and be logged in to all supported video channel apps. So if developing an apps need this level of authentication, please check out the Video Subscriber Account framework!
Below are more frameworks available to developers:
Conclusion
It’s never been a better time to be or become a iOS developer. We haven’t had a chance to look through everything yet, so feel free to post any of your own thoughts, or anything we may have missed!
In the meantime, we’ll be working on making a demo about the new release. Stay tuned!
Want to share something innovative about the new release? Feel free to write us at [email protected].
Thanks for your time reading this article.