Hello everyone, as we all know that Share Extension is appeared from iOS 8, then the capability to share content with other entities, such as social sharing websites or upload services can be done in an easy and convenient way.
We, 9series, an iOS application development company has started doing all the development using Advanced Programming Language Swift.
So today, we are going to build a Shared Extension app in iOS10 with Swift 3.0, an ability to show an icon on the common share-sheet that associates with our main app, which handles the sharing of the content that the user has requested. So the user can easily switch from one app to another, for example, we are sharing a photo from the album with some content that switches our app where we want to upload data to the server.
This is mainly a programming article, so you are required to have Xcode 8 on Mac. Let’s get started !!!
1. Make a new Xcode Project
First Create a cocoa touch Single View Application in Xcode 8 with some basic UI. Like it is shown below
Design the screen with UILabel, UIImageView, UITextView and with UIButton. When user comes with some sharable content from parent app, we can upload or we can use anywhere in our app.
For Eg, let’s create the Share Extension.
Give some proper name of that extension and it will show you popup view for activating your extension scheme. Choose Activate to use this scheme for building and debugging.
Note: Schemes can be chosen from the toolbar or Product menu.
3. Make an App Group
We want to communicate two app for sharing some content, but Apple doesn't want a complete free flow of data between the two. Apple recommends a shared NSUserDefaults as a meeting ground where the two app can exchange their data.
Now, we need to make an app group.
Click on your project in the Navigator Pane of Xcode, click on capabilities and your app under the target list turns on App Groups. Give it a name like “group.BUNDLE IDENTIFIER”.
Now click on your extension and do the same.
4. Implementing Share Extensions in Swift
First open your viewController, we won’t go into much detail, because it's a destination viewController. So we can read content data from User Defaults which is shared by user from Share ViewController.
We have also created an IBAction of Upload button, so that content and photo which is shared by user can be used anywhere in our app.
Here, “sharedIdentifier” is the UserDefaults suiteName that we have used for the app group name. An extensionContext where we get a list of NSExtensionItems. This is a fixed array of data sent to our extension from a parent app. We are getting photo and content from our photos app that are already set to our main app.
Let's look at the “ShareViewController” from our Shared Extension Folder which is subclass of SLComposeServiceViewController. SLComposeServiceViewController has some methods and properties associated with the lifecycle of a share-sheet composition view.
isContentValid() :- It is called every time when the content in the compose view changes. Here, we can check the input data is valid or not. It is called first, and will disable the post button when it evaluates to false.
didSelectPost() :- As the name suggests, it is called when the user presses the post button. Here we can do something with the user input. Once the upload is scheduled, you must call completeRequestReturningItems(, completionHandler:) so that the host app can un-block its UI. When the upload request is done, it calls the completion handler that was passed into the previous mentioned function call.
configurationItems() :- Here, we can add more things for the user to select when they are sharing. In our case we are sharing a photo with contentText. You can also make it more dynamic with some other controls.
contentText :- A string which represents what the user has typed into the composer.
charactersRemaining :- Is a number which appears on the compose sheet. When negative number shows, its appearance becomes red.
Here is the code of “ShareViewController”
Here, we are selecting one image from photo album and then clicking on share button, it will open share sheet with our Share Extension app Icon.
Select that app and it will open composition view.
We have mentioned maximum characters of contentText as 100, so if you enter more than 100 characters, than it will generate alert message and post button will be disabled. You can also check number of characters at the end of compose sheet.
Configuration! items is where we can add more things for the user selection, when they are sharing. Like, Open UITableViewController as subview Controller and selecting User Input it will display as item value at the bottom of compose sheet.
Configuration! items has title, value, and a tapHandler. So you can add extra functionality for selection from User.
ExtensionContext has list of attachment as NSExtensionItem. We’ll loop through the attachments, and look for one typed as an image. It will have the type identifier kUTTypeImage. NSItemProvider items are lazily loaded images, videos, URLs and so on. We’ll load it using “loadItemForTypeIdentifier”. This has a completion handler, where we’ll read the image from the URL, and then we’ll save it to defaults.
After pressing Post Button, It will save Image in UserDefaults with “Image” key, and contentText with “Name” key.
We have created two utility methods for saving data to user defaults and for alert message.
Till now, Apple wouldn’t accept this in their app store. We need to tell iOS when to show our share extension, and what can be selected. Otherwise when we compile we’ll get a warning.
“Warning: Embedded binary’s NSExtensionActivationRule is TRUE PREDICATE”
So for that, open the “info.plist” as source code by right clicking on it. We’re going to change the NSExtensionAttributes section. This means our extension is activated only for images, and only when it’s a single image. If you select more than one image, the extension app automatically hides from share-sheet.
You can change your display name of your app in share sheet by replacing the code in the “info.plist” of your Extension.
5. Test Your Share Extension
1. First you have to simply run your app.
2. Then run your Share Extension.
3. When suggested to choose an app to run, choose Photos.
4. Once the extension starts running, select a photo and tap on the Share button.
5. On the first run, you will need to add your extension to the share sheet.
6. Click on the More button to the right of the other share icons and turn on the switch for your extension & then select Done.
7. Now you will be able to see your extension icon in share - sheet.
8. Select an individual photo and click on share. By selecting your app, add some content and press post button.
The image will be saved to your main app. To confirm this, redirect to your app. You can check the content you entered in the textview and the image above the content.
In this article, our best iOS application developers in India, have only covered some basic UI. You can also make it more dynamic with other controls.
Hopefully, all of this will help you share data with your parent app.
Happy Coding! and feel free to share your own experience on “email@example.com”.
Hey, welcome back!!! Let’s move one step ahead with the open source development language from Swift 3 to Swift 4. We, at 9series, have filtered out points of our next strides in developing mobile apps using Swift 4.
Swift 4 is the latest major release for iOS App Developer that is intended to be completed in the fall of 2017. Its main focus is to provide source compatibility with Swift 3 code while implementing essential feature work that needs to achieve binary stability in the language. It will contain valuable enhancements to the core language and Standard Library, particularly in the generics system and an overhaul of the String type.
Source Compatibility Modes
The Swift 4 compiler will provide two language modes: Swift version 3 and Swift version 4. Swift 3 established the language for source-level stability and now Swift 4 releases source compatibility as a feature moving ahead.
New Features in Swift 4
Swift has many other features to make your code more expressive:
Multi-Line String Literals
To start a string literal, you need to write three double quotation marks: """ then press return. After pressing return key, start writing strings with any variables, line breaks and double quotes. To end multi line string literal again write ””” in new line. Ex:-
Strings are Collections
Just like in earlier version of Swift, Strings can be handled as a collection. No need to write string.characters.something to perform string manipulation.
Dictionary Functionality has Improved
Swift 4 combines some additional functionality to dictionaries to make them more strong, and also to make them work more like you would expect. Let's start with a simple example: Modifying dictionaries in Swift 3 does not return a new dictionary. Instead, it returns an array of tuples with key/value labels.
After that code runs you can't read distinction["Maths"] because it is no longer a dictionary. Instead, you need to use distinction.value, which is not good for us because we apply filter on dictionary and we got an array.
As of Swift 4, this acts more like you would expect: you get back a latest dictionary. Obviously this will break any existing code that relies on the array return type.
Similarly, the map() method on dictionaries got a key-value tuple passed in, and could return a single value to be added to an array.
That has not changed in Swift 4, but there is a new method called mapValues(). It allows you to modify the values and place them back into a dictionary using the original keys.
Here we try to form different buckets where each bucket will contain values having same first character in their name. For Example:-.
It's now likely to obtain a dictionary key and provide a default value to use if the key is missing. In following statement if there is no value for key “Bio” found then it will print default value.
Built in Encoding and Decoding
Swift 4 appears with built-in encoders and decoders for JSON. JSON to Model conversion comes in built in.
One Sided Range
Swift 4 introduces Python-like one-sided collection slicing, where the missing side is automatically assumed to be the start or end of the collection.
Like with other Swift releases, 4.0 was announced at WWDC '17 and released in beta form for developers alongside Xcode 9. This release of Swift added quite a few refinements and features to the programming language. First release of Swift 4.0 will bring overall stability to the source and binary interface, or ABI.
Stay tuned for other technical and development articles.
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:
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.
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.
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.
The 2017 Worldwide Developers Conference keynote was Apple's biggest event in years, with the company introducing both new software platforms and a range of new hardware products.
As usual, the event began with the message for developers “Keep making apps, the world is depending on you”.
And as always, the event started with a keynote during which Apple announced dates (June 5–9, 2017 in San Jose) of updates for their iOS, OS X, watchOS, and tvOS platforms.
A Giant step for iPhone, A Monumental leap for iPad
Messages App Syncs Across Multiple Devices
The first new iOS 11 feature: synchronized conversations across iCloud, iOS, and macOS. Messages are moving to iCloud.
If you erase a message on your iPhone or iPad, then it will also delete from the iPad and the Mac and vice-versa. Our conversations will be stored on iCloud, which will make them easier to retrieve your future Apple devices.
There is also an update related to Apple Pay, which will now be able to pay people. Person-to-person payments let people pay directly from Messages as an iMessage app.
It uses the TouchID fingerprint sensor. And the money which received will go into your Apple Pay Cash Card, which you can use for further Apple Pay payments, or to transfer money back into your account.
It might be helpful to make payment through application and person can directly transfer money to his friends or family members or use as general. Hence, we can enhance our application to the next level in terms of eCommerce market.
Aha, Apple has made improvements to Siri that makes assistant’s voice sound more natural when responding to users. Siri will now be able to perform translations from English to Chinese, French, German, Italian, or Spanish. Wow…
As a ios developers, we can definitely use this feature into multi-language application and give better user-interface as well as performance to our app users.
Siri is also getting smarter about suggestions. On-device, learning is synced across other Apple devices but kept completely private, readable only for you. Siri gives suggestions based on personal usage of Safari, News, Mail, Messages and more. For example, as Siri learns topics or places, a user is interested in while browsing Safari.
The camera also has lots of improvements, including improved image quality. Portrait Mode in the iPhone 7 Plus can be taken with Optical Image Stabilisation, True Tone flash and HDR.
Apple has also added a new technology called High Efficiency Image File Format (HEIF) that reduces the file size of your iPhone 7 or 7 Plus photos.
This can be helpful into the application where Image and its quality is considered as the core concept.
In iOS 11, Apple has redesigned Control Center, which is the thing that users can swipe up to access frequent and important settings or change songs when listening to music.
Drag And Drop For IPAD
Apple is specially focusing on productivity for the iPad with iOS 11.
A new drag-and-drop feature lets you quickly move info or media from one split-screen app into the other besides it. Drag and drop can also be used with apps on your dock or home screen.
Lock Screen Improvement
The Lock Screen in iOS 11 has been improved so that you can see all of your Notifications in one place.
You can see all of your Notifications, simply pull it down from the top of the screen. Then you will be able to see both your recent and missed notifications in one place.
Here, we should take care about sending an extra unnecessary notifications, as our users can’t get bored from such things. And only useful notifications should be seen to attract the user of our application.
Apple announced that the Maps app in iOS 11 will support indoor mall and airport maps. The indoor maps will allow you to see which restaurants are past security at the airport. And you can also see which stores are on what levels in the malls.
Lane Guidance in Maps now encourages you to dodge missing a turn or an exit by showing which lane you should be in when you’re navigating. You can also check the speed limit of the road.
As a mobile app developer, we should think that whether this feature can put our application into an advanced level in terms of event organization kind of feature where our users can easily find the place/stall where he needs to go.
Do Not Disturb While Driving
Apple iOS 11 has a very useful safety called Do Not Disturb while Driving. This feature helps drivers stay focused on the road by automatically silencing notifications. And you can send auto-replies to your contacts in your favorites so that they know you are driving.
App Store App Improvements: A whole new design, A whole new perspective
The App Store has been redesigned from the ground to help you discover new apps and games you can’t live without. You’ll see daily stories by experts, a dedicated Games tab, lists for all kinds of apps, and much more. It’s the biggest thing to come to the App Store since apps. And now apps that are submitted to the Apple App Store are generally reviewed within 24 hours.
Apple is building augmented reality directly into the core of iOS, giving developers the tools they need to convincingly blend digital entertainment with the real world. So with help of this new framework, we can effectively introduce augmented reality into our application.
Now, it’s like behind-the-scenes stuff for iOS. It’s getting Metal 2, of course, and a new set of machine learning APIs letting developers use Apple’s natural language comprehension and facial recognition tools.
macOS High Sierra
Your Mac. Elevated
macOS High Sierra introduces new core technologies that improve the most important functions of your Mac. From re-architecting, it shows how it stores your data & how you watch videos to unleash the full power of the graphics processors.
Apple File System
To your Mac, everything you care about is data. And a file system is what organizes all that data into files and folders you can access with a click. Apple’s current file system was designed in the early days of Mac, and it has performed beautifully ever since. But today’s flash‑based Mac opens up new possibilities for innovation, so it’s time to lay a new foundation. With macOS High Sierra, Apple is introducing the Apple File System to Mac, with an advanced architecture that brings a new level of security and responsiveness.
Below are some bullet points about updates in macOS High Sierra:
More intuitive, More intelligent, More you
Apple announced a new version of watchOS. One of the most noticeable changes in watchOS 4 is the option of using a Siri watch face. This automatically displays contextual information on the Apple Watch, such as approaching appointments, and traffic reports if the wearer is going to work.
New fitness feature includes in controls, more prompts to set goals, and two-way workout data exchange with certain gym equipment. The Apple Watch will also be able to better connect with other hardware gadgets, such as continuous glucose monitors and smart tennis rackets, via NFC. This can be a useful feature where our application also interact with Watch OS.
watchOS 4 also includes a new Music app meant to improve the AirPods experience. Multiple playlists can now be synced including Apple Music-recommended playlists.
The Dock on watchOS 4 has a new look with a vertically scrolling interface with can lead to the UI Interface of the watch application. watchOS 4 can also automatically start when workouts are started, and music playback controls are integrated with the Workout app.
Control Center gains a new flashlight function using the display which also works during outdoor, night workouts as a safety feature.
In WWDC 2017, one thing to say from apple about tvOS, The Apple TV is getting a big new content, as Amazon Prime Video is coming to Apple TV and Apple’s new TV app.
New Macs and the iMac Pro
Now faster across the line
Apple also upgraded its MacBook and MacBook Pro lineup with faster processors and SSDs. It also refreshed the MacBooks.
Apple’s 13-inch MacBook Pro without the Touch Bar on top now comes with Intel core i5 processor clocked at 2.3GHz, 128GB Storage and 8GB RAM. This also has two Thunderbolts 3.0 ports.
iMac Pro: The most powerful Mac ever
The all-new iMac Pro, with its gorgeous 27-inch Retina 5K display, up to 18-core Xeon processors and up to 22 Teraflops of graphics computation, is the most powerful Mac ever made. iMac Pro packs incredible performance for advanced graphics editing, virtual reality content creation and real-time 3D rendering.
Any you can do, you can do better
The new version of the iPad Pro has a 10.5-inch display, 20 percent larger than the previous 9.7-inch model. Apple said that It features a better display with richer color and a new feature called ProMotion, which updates its content up to 120 times per second making it feel smoother and more responsive.
HomePod: Apple’s new Siri speaker
The HomePod has seven tweeters and four-inch woofer; it has an A8 chip living inside it. That’s a feature Sonos has too, letting the speakers adjust their output to, say, push the vocals down the centre of the room while bouncing the bass off the wall.
A feature will respond to “Hey, Siri,” play from your Apple Music account, and answer questions about the music it’s playing. It will also handle other Siri queries, such as weather, news, messages, podcasts, stocks, controlling smart home devices via HomeKit, etc.
Above are the announced points of Apple during WWDC 2017. Though we haven’t had a chance to look through everything yet, feel free to post any missing points or share your thoughts about these new features in iOS app development.
Want to share something innovative about the new release? Feel free to write us at firstname.lastname@example.org.
As we have already referred iOS App Extensions in the previous article, let’s check out the rest of the App Extensions below.
1. Intents Extension
Cooperation with Sirikit occurs through your Intents extension, which is an app extension that you convey inside your iOS app bundle. You should already have an iOS app before you build an Intents extension. The Intents extension handles most communications with Sirikit, yet your iOS app needs to know about those communications and in some cases may have an active role in making them happen.
When adding an Intents extension to your iOS app, you must do the following:
2. Intents UI Extension
When you handle an intent, Siri and Maps often show the details from the response object your Intents extension produced in a standard interface. If you need to add your own custom content to the standard interface, you should give an Intents UI extension.
An Intents UI extension does not supplant the Intents extension that you use to manage intents. It is a different app extension that lets you personalize how your response to an intent is presented to the user. You can utilize a custom interface to demonstrate additional details or to consolidate your app’s branding which can provide a more regular experience for the user.
You can provide an Intents UI extension if you are holding intents in the following domains:
3. Notification Content & Notification Service Extension
i. Notification Service Extension
A Notification Service Extension basically captures definite remote notifications and enables you to deal with the contents of the payload, including downloading and representing remote media attachments, before displaying the notification to the user.
Please note that the URLSession downloads the media to short storage and affixes a .tmp file extension, which we need to eliminate so that the application can interpret the file type and represent it.
ii. Notification Content Extension
The UNNotificationContentExtension decorum gives the entry point for a Notification Content app extension, which illustrates a custom interface for your app’s notifications. You affirm this protocol in the custom UIViewController subclass that you use to present your interface. You create this sort of extension to enhance the way your notifications are presented, possibly by combining custom colors and branding or by incorporating media and other dynamic content into your notification interface. These are basically used to draw your own UI to display when your application receives certain push notifications.
4. Photo Editing Extension
A Photo Editing extension gives users a chance to edit a photo or video within the Photos app. After users verify the changes they make in a Photo Editing extension, the adapted content is accessible in Photos. Photos constantly keep the actual version of the content, too, so that users can revert the changes they make in an extension.
When a user picks a Photo Editing extension, Photos asks the extension if it can read the adapted data. If the app extension supports the adapted data, Photos provides the actual version of the asset as input to the editing session. After the extension reads the adapted data and reiterates the past edits, it can enable users to change or revert past edits or add new edits. For example, if the adapted data implies filters that are applied to a photo, the extension applies filters to the actual asset and can let users change filter parameters, add new filters, or remove filters.
5. Share Extension
Share extensions that are introduced in iOS 8, give users an simple and convenient way to yield content with other entities, such as social sharing websites or upload services. With share extensions, users will now be able to bestow content to your service direct from within the app they are managing, be it Safari, Photos or other apps. This isn’t restricted to system applications. Any custom application that presents an instance of the UIActivityViewController class will have the capacity to see your sharing extension if you assembled your extension so that it can handle the file type provided by that application.
6. Shared Links Extension
Shared Links Extensions appeared with iOS 9 permits our app to embed content into the users' Shared Links section of Safari on iOS or OS X.
iOS will call beginRequestWithExtensionContext(context:) on our extension and that will be our signal to run whatever code we need to load in the content we'd like to show in Shared Links, then pay it in the form of an array of NSExtensionItems.
7. Spotlight Index Extension
The Core Spotlight framework makes the data of an app accessible on the Spotlight, and consequently, bring some good results regarding an app along with any other results that the system returns. That’s quite impressive and innovative, as for the first time users can spot data for custom apps, not simply Apple’s, and interact with them. By saying that users can interact with the results associated with a custom app, it implies that not only the app gets automatically propelled when such a result record gets tapped, but developers are also given the power to manage users to particular view controllers that are most relevant and suitable for the data that were chosen on Spotlight.
From the developer’s point of view, coordinating the Core Spotlight framework and using the provided APIs doesn’t comprise of a difficult process. The “heart” of that process lies to the fact that developers have to “ask” iOS to index their app’s data, which must be described in a particular way prior to that.
By using the Core Spotlight framework it’s possible to make the data of any application searchable through the Spotlight. The key to doing that is to ask precisely from the Core Spotlight API to list our data so it can be found on searches executed by the user. But neither our app nor the CS API chooses what kind of data this is going to be. It’s our duty to prepare that data and provide it to the API in a particular form.
8. Sticker Pack Extension
Apple gives an approach to representing people in generous ways by providing stickers that can be used within their conversations on iMessage. Users can adapt sticker sizes, touch to send stickers in a thread, or peel and place them on top of bubbles, other stickers, and photos. Stickers require no coding to build. With just couple of steps in Xcode, you can transform your images into a sticker pack that’s ready to submit to the new App Store for iMessage.
It’s very simple to make sticker packs for the Messages app on iOS 10 using just a Mac, Apple ID, sticker images. All images are displayed to the end-user in a grid-based system on the device, with Apple also taking the opportunity in the iOS Guidelines to make some suggestions on how to best appeal device owners, including each image under 500KB in size.
9. Today Extension
Today Extensions is also known as Widgets. This enables you to manifest information in the Notification Center, which can be an awesome approach to give immediate and up-to-date information that the user is interested in.
Extensions created for the today’s extension point, the so-called widgets, are meant to provide simple and quick access to information. Widgets link to the Notification Center framework. It's essential that you design your widget with an easy and focused user interface, because too much interaction can be a problem. Also, note that you don't have access to a keyboard.
Widgets are expected to perform well and keep their content updated. Performance is a big point to consider. Your widget needs to be set rapidly and utilize resources wisely. Here, take a note that the system terminates widgets that use too much memory.
These app extensions are incredible features in top iOS app development that apps should take advantage of. In this article we, as a mobile app developers, have looked at each Extension in app. In the coming articles we will look at the development of extensions available for iOS, so stay tuned.
If you have any comments or questions, feel free to contact us on “email@example.com”.
Bluetooth Low Energy is a wireless personal area network technology designed by the bluetooth Special Interest Group (SIG).
Bluetooth low energy (formerly known as Bluetooth Smart) is a universal low-power wireless standard that makes it easy to connect any product to a smartphone or tablet.
The most common use case of bluetooth low energy is transferring small amount of data between nearby device.
Support for bluetooth low energy is available on most major platforms as of the versions listed below
BLE is used for making application type of connected watches, tracking tags, sports and fitness sensors, healthcare sensors and remote controls. It is also seen in Smart Home applications such as connected door locks and lightings.
Advantages of BLE are :
The device called “Beacon” works on a BLE which is charged by Battery or USB transmits the signal to our device.
It is important to understand that BLE and Bluetooth both are completely different technologies. Bluetooth transmits more data with more range, whereas on other hand BLE share small amount of data with shorter range.
Each BLE Beacon consists a Unique identifier known as a UUID.
Beacon also give data like distance from beacon, major and minor proximities of beacon.
As compared to GPS which is also used to get user’s location where he/she exactly are located, GPS consume more power and might not work in some indoor location in other hand. Beacon are better option to get Proximity (Immediate,Near,Far) location and distance in indoor locations too.
Now Beacons can be used in many ways. Retailers have already started using it in such a way like,
As a Mobile Application Developer (Android Developer) we should look into some practical part too. So, basically there are four things which we need to understand.
1. Beacon Region- Regions are specific area defined by the beacon with its UUID.
2. Beacon Monitoring- It is a technique to find a beacon when user enters in the Region of the beacon or exits from the region.
3. Beacon Ranging- It is a technique to get list of beacons which are in the region and can get beacons proximity, distance, UUID, Major and Minor.
4. Beacon Transmitting- It is a technique to use Mobile Device as a Beacon device, a device which is compatible to transmit the beacon.
There are so many SDK’s and Libraries available in the market to achieve this thing simply and from that some are paid and some are free. Choose the best library available in the market as per your requirement.
9series, a top mobile app development company, has widely worked across both iOS and Android platforms, making splendid apps adored by all smartphone users everywhere throughout the world. Being an accomplished mobile app development specialist, one can state that their mobile apps gather best response among clients and yield greatest engagement.
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.
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.
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.
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 India. Stay tuned with us for more technical and advanced articles.
Feel free to share your queries, thoughts or focuses on “firstname.lastname@example.org”.
As we all know, the latest WatchOS has been released which brings you faster performance, easy navigation, advanced fitness features, the Breathe app and more powerful Messages.
Being an iOS application developer we first need to check with its basic concepts, how the structure is defined, what kind of execution is there, etc.
Hence, we, 9series, are releasing our first article with basic concepts, frameworks, design patterns, architecture of Watch OS.
So, let’s start with this theoretical chapter:
What is WatchOS ?
WatchOS is the mobile operating system of the Apple Watch, developed by Apple Inc. It is based on the iOS operating system and has many similar features.
Developing for apple watch means providing your user important, impactful, helpful information in a most convenient way.
What is WatchKit?
WatchKit is Apple’s framework for building apps from Apple Watch,and it is bundled with Xcode. WatchKit watch app is not a standalone app instead they require to pair with an iOS app running on the user's iPhone.The watch app you built will just be an extension of iPhone app.The iPhone app is responsible for managing and maintaining the Watch app.The iPhone app communicates with Watch app using watchKit.
The most important thing to understand about Watchkit app is that the Apple watch is just an external display for a program running on a connected iPhone.
The Apple watch will come in two screen size 38mm and 42mm with retina display. We do not need to design for both screen size Xcode will automatically adapt the layout to fit the screen size.There is no autolayout however watchkit use its own layout system.
Watch App Architecture
When the user selects your Watch app from the Home screen, watchOS launches it into the foreground. Your app remains in the foreground until the user dismisses it. Even when not in the foreground, your app may still run periodically. Specifically, apps run in the background when their complication is on the current watch face, when the app is in the dock, and when they are handling notifications. In addition, apps in the dock and apps with an active complications remain in memory, which lets the system launch them more quickly.
WatchKit App Project Structure
By adding a WatchKit application to our project, Xcode has created two targets for us, one for the WatchKit extension, and one for the WatchKit application.
The project created for Apple Watch consists of two separate bundles: a watch app and a watch kit extension. The watch app bundle contains the storyboards and resource files associated with all of your app's user interfaces.The watch kit extension bundle contains the extension delegates and the controllers for managing those interfaces and for responding to user interactions.While these bundles are distributed inside an iOS app,they are then installed on the user's Apple Watch and runs locally on the watch.
A WatchOS Project must include a Watch app, but may also include a glance, custom Notifications and complications. Each of these interface provides a unique way for users to interact with your app, often conveying important information to the user more quickly to the app's main interface.The glance and notification are included in watch app’s storyboard.The code for managing the glance, notification and complications are part of the watch kit extension.
WatchApp Life Cycle
A. The applicationDidFinishLaunching method is called. B. The applicationDidBecomeActive or applicationWillResignActive method is called. C. The applicationWillEnterForeground or applicationDidEnterBackground method is called.
What Is an Interface Controller?
An interface controller is an instance of the WKInterfaceController class or a subclass thereof. The WKInterfaceController class is defined in the WatchKit framework.As you know, a view controller controls a view or view hierarchy. An interface controller, however, doesn't control a view, instead it controls an interface, that is, a screenful of content.
An interface controller controls the behavior of the user interface. With an interface controller, you can configure the user interface of your WatchKit application and respond to the events which WatchKit application forwards to the WatchKit extension.
Interface Controller Life Cycle
The WKInterfaceController are analogous of UIViewController but do have same level access to the view component. For Example You cannot add dynamic Controls and restructure UI.
Types of User Interface
1. Normal Interface : The interface.storyboard consist of different scene and each scene has a corresponding WkInterfaceController.
2. Glance : Glance are Single Page, non-interactive UIs that are intended to provide summary or crucial Data. With a swipe from a bottom of watch face, a glance displays app's most important information.The glance are non-scrolling and must fit in single screen and the information in glance are read only so glance do not contain buttons,switch and other interactive controls.Tap on glance launch watch app main screen.
3. Notification : Local and remote notifications are a way to communicate information to the user even when your app is not running. Both local and remote notification are supported. When an iOS app receives a notification, the operating system will decide whether the user should be notified of this event on the iPhone device or the paired Apple Watch device. If, for example, the iPhone is currently locked and the user recently interacted with the Apple Watch, the notification will most likely be delivered to the watch.
Not all iOS apps receive notifications, of course, but for those who perform it is important. The companion WatchKit app handle those notifications appropriately.
For many WatchKit apps it may not be necessary to make any changes to support notifications. In fact, the only step necessary to provide basic notification support for a WatchKit app is to add appropriate sized notification icons within the AppIcon image set of the WatchKit app bundle.
By default, if a notification arrives for an iOS app with a companion WatchKit app, the system will first decide whether to display the alert on the iPhone or the Apple Watch. In the event where the notification is delivered to the Apple Watch a “short-look” notification scene will first be displayed.
Complications are small elements that appear on the watch face and provide quick access to frequently used data. A calendar app might,for example,use a complication so that the user can see the date and time of the next upcoming appointment simply by glancing at the clock face in which the complication has been enabled.The system provides built-in complications for weather information, upcoming calendar events, the user’s activity, and many more types of data.The size and placement of complication is determined by watchOS and is based on available space on the selected watch face.
Complication Families: Modular Small,Modular Large,Circular Small,Utilitarian Small,Utilitarian Large
Thanks for your time to read this article. We hope you enjoyed basic and core concept of Watch OS shared by our best iOS application developers in India. Stay tuned for our next article very soon which include the features of Watch OS 3.x.
As usual, feel free to share your queries, ideas or points to discuss on “email@example.com”.
Note - Images rights belong to their respective owners.
When we are taking a shot at iOS application, we are thinking of new features for making our app great. Apart from improving / enhancing our app, we ought to instrument its code also. The Instrument allows you to check your code for performance issues, memory issues, reference cycles, and other problems. With the help of these instruments, we can bug-free potential applications as best as possible.
Xcode incorporates a performance tuning application named Instruments that monitor your app’s network and file I/O activity.
Let’s investigate it one-by-one and its usage:
1. Activity Monitor
Activity Monitor is an awesome utility to monitor what type of applications and services are chewing up CPU cycles, energy hogs, and other things that might slow your Mac down. Using activity monitor one can figure out why iPhone was chewing the battery when comes in sleeping mode. When Instruments comes in a sleeping mode, One can easily monitor devices and its processes.
The Allocations instrument captures information about memory allocation for an app. You can inspect that everything is in sequence or not. If you happen to be working on Swift, all of your Swift objects will get prefixed with the application name. If you are working on Objective-C, it's a little bit difficult to find, essentially have to know the names of the things you are looking for. If you happen to have prefixed your files you can search on that prefix and see all your objects that way, or you can seek on some naming scheme you might have used.
If you click on the little arrow next to the object, it’ll show you all the allocations of that object, and who is responsible for creating it. Then, if you click on the little arrow next to one of those allocations, you can see the detailed information about its retain and release count. If that number doesn’t reach 0, it won’t get deallocated.
It includes Allocation and Leak templates that will help you see all the memory allocations and potential leaks that are happening.
You cannot get an excessive amount of detail on the Leaks panel, but it will take snapshots for you, at specified intervals, to see if you have any memory that has been allocated yet not able to deallocate. This often happens in the case of Objective-C and using some of the C libraries where you are responsible for releasing any allocated memory. If you are working on Swift, these leaks are less common as it takes care of some of the things you used to do with Objective-C.
4. Timer Profiler
At the time of running your application, sometimes you can be delayed in performing some task. If you want to examine that, the Timer Profiler instrument is very beneficial. It will be more effective, how to make your apps faster, more efficient and can be used to identify problems and verify your fixes. It is easy to improve your app's power usage and performance.
5. Energy Log
It monitors factors that influence energy usage on an iOS device, including CPU activity, network activity, screen brightness, and more. Keep note that this tool doesn’t supports in simulator.
It gathers data from your running app and presents it in a graphical timeline. Identify the areas where usage is highest, and see if you can reduce impact in those areas.The Energy Usage instrument indicates a level from 0 to 20, indicating how much energy your app is using at any given time.
6. Network Connection
The Connection instrument captures information about TCP/IP and UDP/IP networks activating over time. Like Energy Log, this tool also doesn’t support in simulator. The timeline pane displays graphs that represent the amount of network activity in the following categories:
7. System Trace
This template provides comprehensive information about system behaviour. It shows when threads are scheduled, and shows thread transitions from user to system code via system calls and memory operations. This template may be used with OS X or iOS.
8. OpenGL ES Analyzer
The OpenGL ES Analyzer instrument captures information about OpenGL ES activity. It detects problems and offer solutions based on best practices and knowledge of Apple’s hardware and software platforms. Again, this tool also doesn’t supports in simulator.
It displays following trace details:
9. System Usage
This template monitors an app and records system I/O activity related to files, sockets, and shared memory. This includes inputs, outputs, duration, backtrace, call tree, and more for each call. This template may be used with iOS only.
The I/O Activity instrument captures information about I/O events.
10. GPU Driver
Monitors GPU hardware activity. This Instrument monitors GPU-side events. Keep note that this tool doesn’t support in simulator.
The following GPU activity columns are available in the detail pane.
This template measures general memory usage of an app, focusing on the detection of over-released objects, known as zombies. It provides statistics on object allocations by class, as well as memory address histories for active allocations. This template may be used with OS X or iOS.
12. Core Animation
This template uses time profiling to measure graphics performance and CPU usage in an app. This template may be used with iOS only. This tool doesn’t support in simulator.
The Core Animation instrument captures information on selected animation statistics. You may see spikes in the timeline pane where the frame rate of the app becomes significantly better. In some cases, however, spikes can be caused by changing the device between landscape and normal orientation—and if you don’t know this, you might spend time trying to find what caused the performance increase.
It is a powerful tool you can use to collect data about the performance and behaviour of one or more processes on the system.
14. Core Data
The Core Data Fetches instrument that captures information about data store fetch operations performed by Core Data applications. It can record information from a single process or all processes. The all-processes option records information only from running Core Data applications. You can export recorded information to a DTrace script. This tool doesn’t support in simulator.
The timeline pane displays the following information, based on the instrument’s configuration:
It also records the information regarding:
15. File Activity
In file activity, It captures information about file open, close, and start operations. In read/ write, it captures information from reads and writes to files. This includes the read, write, pread, and pwrite functions. This instrument uses DTrace in its implementation and can be exported to a DTrace script. Keep note that this tool doesn’t support in simulator.
In File Attributes, it captures information about changes to ownership and access permissions for files. You can export recorded information to a DTrace script. In Directory I/O, it captures information about directory operations, specifically the delete, link, mkdir, mount, rename, rmdir, symlink, unlink, and unmount functions.
The Counters instrument records information from user-managed PM (Performance Monitor) events. Keep note that this tool doesn’t support in simulator.
17. Cocoa Layout
The Cocoa Layout instrument captures information on changes to NSLayoutConstraint objects. Keep note that this tool doesn’t support in simulator.
18. Metal Application
Records Metal application events. It displays a graph indicating Metal application events.
This article demonstrated the instrument tools in Xcode. Although it’s embedded within and may be used with Xcode, Instrument is a separate app, which may be used independently as needed.
Incorporating Instruments into your workflow from the beginning of the app development process can save you time later by helping you find issues early in the development cycle.
Once you become more comfortable with the tooling, you’ll end up using it more, and the better your code will become. You’ll become more proactive about checking on things that you know might cause an issue and it’ll become part of your standard workflow.
Hopefully, all of this will help you track down and fix those memory leaks.
At 9series, our smart developers are using these tools to check application usage, performance of app, memory leak, etc… based on application usage, requirement and use-cases.
Happy Healthy Coding !!!