Skip to main content

Posts

Showing posts from July, 2017

UI Tests with Xcode 8

Generic approach to iOS UI Tests in SwiftPage object conceptWWDC 2017 What's New in TestingXcode Automated UI Tests & NSUserDefaultsThe solution I found was to write to the launchArguments property of my XCUIApplication instance in my test class, and then read that parameter in my AppDelegate class.XcodeUITestingExperimentsNetworkStubbingExperimentFileSystemManipulationSystemLogQueryLightweight IPC with the Darwin notification centerSelf-contained UI tests for iOS applications Disabling animations Page objectsAssert helpersNetwork data stubbing with Wire MockUsing data from mocks in testsInstrumentation Testing RobotsLibraries like Espresso allow UI tests to have stable interactions with your app, but without discipline these tests can become hard to manage and require frequent updating. In this talk Jake will cover how the so-called robot pattern allows you to create stable, readable, and maintainable tests with the aid of Kotlin’s language features.

Detect if your Native app is installed from your web site

As the capabilities of the Web become more aligned with what was once the domain of native experiences there are an increasing number of times where a developer will want to reduce the confusion for their users who have both the web and native apps installed.

In Chrome 59 we are introducing a new API called getInstalledRelatedApps(). This new API lets you determine if your native app is installed on a device.

Paul Kinlan @ Medium.com

Apple iTunes Auto-Renewables: Increase price of existing auto-renewable subscriptions while keeping existing subscribers at their current price

If you increase pricing, you can either maintain the current price for existing subscribers or apply the price change for all users. As you go through the workflow outlined in Making Price Changes to Auto-Renewable Subscriptions, you can choose whether to apply the price increase to all subscribers.

As of iOS 10.0, if you decide to increase prices for existing subscribers, Apple will notify the subscribers of the price increase, along with the date they will be charged the new price. They’ll need to agree to the new price before they're charged. If they don't agree, their subscription won't automatically renew.

Note that price preservation is only available when you increase pricing; not when you decrease pricing. Price decreases will be immediately applied to all subscribers paying a price higher than the one you set.

Apple Developer Documentation

Speed up your unit tests! Swap out your App Delegate for testing.

Faster, please
One thing that can slow our tests down is if our App performs expensive tasks on startup and it is not unusual to place code that synchronizes with a server in our implementation of UIAppDelegate.

Luckily for us there is a way to change the production App Delegate with a fake that does nothing.

Objective-C
class FakeAppDelegate: UIResponder, UIApplicationDelegate {
  var window: UIWindow?

  func application(application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
    self.window?.rootViewController = UIViewController()
    return true
  }
}

let isRunningTests = NSClassFromString("XCTestCase") != nil

if isRunningTests {
  UIApplicationMain(Process.argc, Process.unsafeArgv, nil,
    NSStringFromClass(FakeAppDelegate))
} else {
  UIApplicationMain(Process.argc, Process.unsafeArgv, nil,
    NSStringFromClass(AppDelegate))
}

Swift
class FakeAppDelegate: UIResponder, UIApplicationDelegate {
  var window: UIWindow?

  func applicat…

10 new iOS libraries

Hydra
Hydra is full-featured lightweight library which allows you to write better async code in Swift 3+.

Lottie
Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with bodymovinand renders the vector animations natively on mobile and through React Native!

Hero
Hero is a library for building iOS view controller transitions. It provides a layer on top of the UIKit’s cumbersome transition APIs. Making custom transitions an easy task for developers.

Charts
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.

JTAppleCalendar
The Unofficial Swift Apple Calendar Library. View. Control. for iOS & tvOS

and more...

Seyhun AKYÜREK at Medium

Unidirectional Data Flow Architecture (Redux) in Swift

In this post, I try to explain why using Redux with Swift is better idea [than MVVM].

What is Redux and Unidirectional Data Flow?

Redux is a flux implementation but slightly better implementation, it makes your application’s state more predictable. It first came out in Javascript world as a predictable state container for JavaScript apps with the powerful javascript library React.

Redux, simply makes your application’s state in single store object. So firing an action from your application/in view’s lifecycle state changes and your reducers for that action generate a new state.


Seyhun Akyürek at Medium

Extract sub-libraries from a given iOS/Swift library without access to source code to avoid namespace clashes using lipo and ar command

We at WeltN24 were facing the problem that two libraries that we integrated in our iOS project, used the same sub-library which resulted in naming conflicts due to the non-existing namespaces in Swift.

If you know what you are doing you can try to solve this conflict by extracting the shared sub-library from one of the libraries you want to integrate. You can even do this if you don't have access to the source code using the lipo (create or operate on universal files) and ar (create and maintain library archives) commands.

Why you should know what you are doing?
Manipulating unknown archives can result in unforseen effects because of the fact that you don't know anything about how the provider of the archive uses the sub-library, which version of the library was used or if the source code of the library was manipulated. So...
You should know what you are doing manipulting archives :)

The script is processing the files in following order:

Extracting architecture slices of multi-…

10 Kotlin Tricks in 10 ish minutes by Jake Wharton Devoxx

Why Core ML will not work for your app (most likely)

While the buzz around newly released Apple framework is loud, I want to explain several things, that may not be obvious for those who are new to machine learning (ML).


Core ML is not a machine learning framework.Core ML supports only two types of ML.If your models are proprietary or contain sensitive information, you can’t use CoreML.Core ML doesn’t solve the privacy concerns.Core ML doesn’t compress models.Core ML is not the only way to do machine learning on iOS.

Learn Machine Learning, not Core ML.

Impervious Invisibility