iNVASIVECODE
1.0K views | +0 today
iNVASIVECODE
Company news
Your new post is loading...
Your new post is loading...
Scooped by Eva Diaz-Santana
Scoop.it!

iOS Development | Dynamic animations: UIFieldBehavior - iOS Development

iOS Development | Dynamic animations: UIFieldBehavior - iOS Development | iNVASIVECODE | Scoop.it
UIKit Dynamics API allows you to build dynamic animations with simplified physics that is useful for building a prototype model. UIFieldBehavior is one of them
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Machine Learning for iOS

Machine Learning for iOS | iNVASIVECODE | Scoop.it
Machine learning is becoming a hot topic. Learn how to integrate convolutional neural networks in your iOS, tvOS and macOS applications.
Eva Diaz-Santana's insight:
What is Machine Learning? This blog post provides a great overview of the hot topic of ML and how it relates to Artificial Intelligence.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Custom View Controller Transitions and Storyboard - iOS Development

Custom View Controller Transitions and Storyboard - iOS Development | iNVASIVECODE | Scoop.it
This tutorial shows how to create custom view controller transitions using the new UIKit APIs introduced by Apple and associate them to storyboard segues.
Eva Diaz-Santana's insight:

#uikit #swiftlang #invasivecode #iOS

more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

GameplayKit State Machine for non-game Apps

GameplayKit State Machine for non-game Apps | iNVASIVECODE | Scoop.it
Learn how to create a state machine for non-game Apps using Gameplay Kit introduced in iOS 9. Reduce complexity using this powerful tool.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

UIAlertController iOS Alert and Action Sheet

UIAlertController iOS Alert and Action Sheet | iNVASIVECODE | Scoop.it
UIAlertController allows you to present an alert or action sheet to the user. Learn how create and handle alerts and action sheets in your iOS app.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

iNVASIVECODE on Twitter

iNVASIVECODE on Twitter | iNVASIVECODE | Scoop.it
New highly-detailed Core Animation iOS Blog by @evdiasan | CAScrollLayer for Xcode https://invasivecode.com/weblog/core-animation-scroll-layer-cascrolllayer … #Xcode pic.twitter.com/wAe172RH8Q
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Core Animation Scroll Layer: CAScrollLayer

Core Animation Scroll Layer: CAScrollLayer | iNVASIVECODE | Scoop.it
In this tutorial, I will show you how to use a CAScrollLayer that can be used to display a portion of its sublayers and to animate them using Core Animation
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Designer details how Apple's iAd Producer can be used to prototype iOS & Mac ... - 9 to 5 Mac (blog)

Designer details how Apple's iAd Producer can be used to prototype iOS & Mac ... - 9 to 5 Mac (blog) | iNVASIVECODE | Scoop.it
Linda Dong, a former Prototyping Team member at Apple, shared a fascinating blog post this week that highlights an interesting use case for developers and designers using Apple's iAd Producer app. ...
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

iOS Development Weblog

iOS Development Weblog | iNVASIVECODE | Scoop.it
Core Data Batch Updates in iOS 8 and Swift
http://t.co/e1mDMs60My #swiftdev #appdeveloper http://t.co/qNwtIEoFSv
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

iOS Development Weblog

iOS Development Weblog | iNVASIVECODE | Scoop.it
Swift 1.2: Faster Executables



Swift 1.2 was announced a couple of weeks ago. Now, you can download it together with Xcode 6.3 beta 2 from the developer portal.



As I read about the new features for Swift 1.2 in the Swift blog for Apple Developers, one highlight feature captured my attention. It reads:




Faster executables - Debug builds produces binaries that run considerably faster, and new optimizations deliver even better Release build performance.



So, faster debug builds, great. But I’m more interested in Release build optimization. Can Swift execute faster than C?







This is the important question, especially for me. I develop image processing and pattern recognition algorithms for mobile applications, and the number of operations involved are usually really huge. For example, if an image has a size of 640x480 pixels in grayscale, one has to process 307200 pixels. And if you perform a convolution (a very common operation in image processing) between this image and a kernel of size 15x15 pixels, you end up performing 225(=15x15) multiplications and 224(= 14*15+14) additions for each pixel of the 640x480 image.



Now, imagine performing a convolution in real-time, processing the frames from the video camera of your iPhone. An algorithm that processes such rapid images must execute really, really fast to match the 30 frames/s of your iPhone camera. Of course, you can use the GPU (and actually, you should), but not every algorithm can run on the GPU.



Swift to the rescue!



Let’s see how Swift performs on these algorithms compared to C in Release mode. Here, I will compare Swift performance against C performance for image processing algorithms.



I have compared, many times, a few of my C algorithms to their Swift version, and the speed comparison always favored the C implementation. But now, we have Swift 1.2, with its “Faster executables” feature. So, I downloaded Xcode 6.3 beta 2 and I updated my code to Swift 1.2 using the provided script (you can find it in Edit -> Convert -> To Latest Swift… and follow the wizard - very straightforward).



As a testing algorithm, I chose the Otsu’s thresholding algorithm, which I have for both C and Swift. I created a performance test using the -measureBlock method and ran the test on an iPhone 6 in Release Mode and set the compiler optimization to -Ofast.



self.measureBlock() {
// Image processing
let threshold = self.vc.otsuThresholdForImage(bitmap, width: w, height: h)
self.vc.thresholdImage(bitmap, width: w, height: h, threshold: threshold)
}




The first method inside the closure computes the threshold value as explained here. The second method thresholdImage(_:, width:, height:, threshold:) applies the threshold to the entire image:



func thresholdImage(bitmap: UnsafeMutablePointer UnsafeMutablePointer {
let result = UnsafeMutablePointer.alloc(Int(w*h))
for var i:Int = 0; i < Int(h); i++ {
for var j:Int = 0; j < Int(w); j++ {
result[i * Int(w) + j] = bitmap[i * Int(w) + j] <= UInt8(value) ? 255 : 0
}
}
return result
}




As you might know, measureBlock executes 10 times the block of code inside the closure. I then ran the algorithm on images with different size: 640x480, 1920x1200, 3008x2000, 4544x1952, 4542x3907. Here’s a small table with the results:



Image size Swift 1.1 Swift 1.2 C
640x400 0.002s(8% STDEV) 0.002s(17% STDEV) 0.002s(12% STDEV)
1920x1200 0.021s(10% STDEV) 0.019s(5% STDEV) 0.013s(10% STDEV)
3008x2000 0.049s(3% STDEV) 0.047s(6% STDEV) 0.034s(16% STDEV)
4544x1952 0.072s(5% STDEV) 0.067s(8% STDEV) 0.046s(11% STDEV)
4542x3907 0.142s(6% STDEV) 0.139s(8% STDEV) 0.094s(12% STDEV)




So, unfortunately, there was nothing really exciting. I repeated the same tests for other image processing algorithms and the results showed, as highlighted in the previous table, similar relative differences.



Notice that the increase of number of pixels (larger image size) increases the difference between Swift 1.2 and C. So, C executes faster when the number of data increases.



Also notice that difference between Swift 1.1 and 1.2 is not really significative.



In Debug mode, the results are completely different. There, Swift 1.2 is incredibly faster than Swift 1.1 (almost 4-5x). But, again this is Debug mode. Nothing really interesting for the final applications.



C remains faster in Release mode for this type of algorithms, and there is a slight improvement between Swift 1.1 and 1.2. Of course, this new version of Swift comes with the tools still in beta, so there’s still space for improvement. But when will Swift bid C?



Geppy



Geppy Parziale (@geppyp) is cofounder of InvasiveCode. He develops iOS applications and teaches iOS development since 2008. He worked at Apple as iOS and OS X Engineer in the Core Recognition team. He has developed several iOS and OS X apps and frameworks for Apple, and many of his development projects are top-grossing iOS apps that are featured in the App Store.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Attributed String for iOS in Swift by iNVASIVECODE

Attributed String for iOS in Swift by iNVASIVECODE | iNVASIVECODE | Scoop.it
Attributed String for iOS in Swift



I have been talking quite a lot in the past about how to customize text in your app to improve the UI of your applications. Before iOS 6, Core Text was the only available option for developers. Although a great framework, Core Text is not a very straightforward tool to use. You can check our Core Text tutorial in Objective-C here. In iOS 6, Apple introduced NSAttributedString. You can check a couple of posts about this topic here and here.







Core Text still remains the way to go for some specific cases that we will see later but NSAttributedString brings less hassle so, if possible, you should adopt it as a your first option. Then, on early June 2014, Apple introduced Swift. In this tutorial, we will build a project using Swift and NSAttributedString.



First, let me tell you more about some Cocoa classes that give you easy access to text customization. NSAttributedString allows you to customize the text attributes of UILabel, UIButton, UIPickerView, and UITableViewCell.



To use these properties, you just have to add any object of type UILabel, UIButton, UIPickerView or UITableViewCell to your project and assign an NSAttributedString. For example, for a UILabel object, you would do the following:



self.labelName.attributedText = attributedString




Let’s build an example



Let’s write some code to see how to create attributed strings using Swift.



Launch Xcode and create a new Single-View Application project. Name it AttributedStringExample. Open the ViewController.swift file and edit the viewDidLoad() method as follows:



override func viewDidLoad() {
super.viewDidLoad()
if let titleFont = UIFont(name:
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Tweet from @invasivecode

Tweet from @invasivecode | iNVASIVECODE | Scoop.it
Be an iOS Developer, this Halloween. https://www.invasivecode.com/oct-27-ios-training.html … #Halloween #Apple #SanFrancisco pic.twitter.com/wifmMli06A
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Tweet from @invasivecode

Tweet from @invasivecode | iNVASIVECODE | Scoop.it
Construct iOS apps. https://www.invasivecode.com/oct-27-ios-training.html … #Appledevelopment #SanFrancisco #swiftlang pic.twitter.com/nx5I889eJ8
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Network Reachability in Swift

Network Reachability in Swift | iNVASIVECODE | Scoop.it
Network reachability is very important for mobile application. This tutorial shows you how to write a reachability class in Swift 3 for iOS.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

tvOS Focus Engine and Collection View - iOS Development

tvOS Focus Engine and Collection View - iOS Development | iNVASIVECODE | Scoop.it
I recently did some consulting work for a new startup here in San Francisco. I built for them a couple of quite complex UI animations for an Apple TV app. Doing so, I was able to work very closely with tvOS and its very interesting interaction mechanism: the Focus Engine. I am quite fascinated by...Read More
Eva Diaz-Santana's insight:
Great new post about tvOS and UI animations by @geppyp
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

iOS Training Bootcamp

iOS Training Bootcamp | iNVASIVECODE | Scoop.it

Basic and Advanced iOS Training Bootcamp. Learn to build and develop native iPhone, iPad, and Apple Watch apps for Apple AppStore. Tailored iOS training.

Eva Diaz-Santana's insight:

#invasivecode #iostraining #SanFrancisco #Swift #iOSProgramming

more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Strong IBOutlet, Storyboard, Scene Dock | iNVASIVECODE

Strong IBOutlet, Storyboard, Scene Dock | iNVASIVECODE | iNVASIVECODE | Scoop.it
Learn the new storyboard features in Xcode 7, the strong IBOutlets and ARC, how to add an extra view and the scene dock. Create custom segue transitions.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

MapKit for iOS 9: Flyover, Transit and Customization - iNVASIVECODE iOS Blog

MapKit for iOS 9: Flyover, Transit and Customization - iNVASIVECODE iOS Blog | iNVASIVECODE | Scoop.it
Flyover and Transit are the new available features for iOS 9. This development iOS tutorial shows how to implement these functionalities in your iOS apps.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

iNVASIVECODE on Twitter

iNVASIVECODE on Twitter | iNVASIVECODE | Scoop.it
Awesome new iOS Developer Blog | Core Animation Scroll Layer https://invasivecode.com/weblog/core-animation-scroll-layer-cascrolllayer … #Xcode #apps #animations pic.twitter.com/XlJ4HXrMBy
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

UIStackView Auto Layout Core Animation

UIStackView Auto Layout Core Animation | iNVASIVECODE | Scoop.it
UIStackView for iOS 9 leverages the power of Auto Layout. If combined with Core Animation, it brings your iOS UI to new life.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

LLDB Debugging | Advanced Xcode Tutorial

LLDB Debugging | Advanced Xcode Tutorial | iNVASIVECODE | Scoop.it
Use LLVM and the Xcode LLDB debugger with the expression command for code injection when developing and debugging iOS and watchOS apps.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

UIKit Dynamics and Auto Layout

This videos shows how to combine UIKit Dynamics and Auto Layout. How to do it? Check this post: http://weblog.invasivecode.com.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

iOS Training Bootcamp Swift Objective C - March 23-27 - San Francisco CA

iOS Training Bootcamp Swift Objective C - March 23-27 - San Francisco CA | iNVASIVECODE | Scoop.it
Learn to develop and build native iOS apps for iPhone, iPad, and Apple Watch, using Swift Objective-C and Xcode. Attend in our 5-day iOS Bootcamp.
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

San Francisco iOS 8 training, in Swift, is almost full. http://www.invasivecode....

San Francisco iOS 8 training, in Swift, is almost full. http://www.invasivecode.... | iNVASIVECODE | Scoop.it
San Francisco iOS 8 training, in Swift, is almost full. http://www.invasivecode.com/oct-27-ios-training.html #modern #Appledevelopers
more...
No comment yet.
Scooped by Eva Diaz-Santana
Scoop.it!

Tweet from @invasivecode

Tweet from @invasivecode | iNVASIVECODE | Scoop.it
Last Chance to apply. October 27th iOS 8 development class. https://www.invasivecode.com/oct-27-ios-training.html … #ios8 #swiftlang #California pic.twitter.com/BoYkA18yOO
more...
No comment yet.