#321: Opening Files from the Files App ?
Little Bites of Cocoa
by
3y ago
Apple's Files.app is a great way to interact with files on iOS. Today we'll begin taking a look at how our app can better integrate with it. First up, we're going to learn how to allow users to open files in our app, from the Files.app. Let's get started. We'll begin by creating a new project with the Single View App template in Xcode. In the future, we'll look at how Document Picker apps work, but for simplicity, we'll use just a plain single view app this time. Then, we'll head into our AppDelegate.swift file, and add a new function: func application( _ app: UIApplication, open inputURL: UR ..read more
Visit website
Weekly Sponsor: Nevercode ??
Little Bites of Cocoa
by
3y ago
We're welcoming back a great sponsor this week, it's Nevercode! Continuous integration can be one of the best ways to build solid mobile apps. Nevercode delivers an awesome implementation of it for iOS, Android, Cordova, Ionic, React Native, and even Flutter-based mobile apps. Nevercode enables developers to build, test and deploy native and cross-platform mobile applications automatically without any human interaction or any configuration headaches. Setting up a new project is easy thanks to Nevercode's awesome automatic configuration functionality. Nevercode will build our project for every ..read more
Visit website
#320: Counting Enum Cases with CaseIterable ?
Little Bites of Cocoa
by
3y ago
Back in Bite #292 we looked at Sourcery and how we could use it to add handy properties like count to our Swift enums. Sourcery is still just as awesome but Swift 4.2 actually removed the need for using it in this... case. ? Let's take a look. We'll start with the problem we're trying to solve. Let's imagine a simple enum: enum Spaceships { case tantiveIV case ghost case falcon } We'll be adding to the list of cases in our enum frequently as new spaceships are added, and we'd like to display the number of spaceships in our app. We could extend our enum, adding a count property: extension S ..read more
Visit website
Weekly Sponsor: Nevercode ??
Little Bites of Cocoa
by
3y ago
We're welcoming back a great sponsor this week, it's Nevercode! Continuous integration can be one of the best ways to build solid mobile apps. Nevercode delivers an awesome implementation of it for iOS, Android, Cordova, Ionic, React Native, and even Flutter-based mobile apps. Nevercode enables developers to build, test and deploy native and cross-platform mobile applications automatically without any human interaction or any configuration headaches. Setting up a new project is easy thanks to Nevercode's awesome automatic configuration functionality. Nevercode will build our project for every ..read more
Visit website
#319: Detecting Gestures on the Apple Pencil ✏️
Little Bites of Cocoa
by
3y ago
Last week's introduction of the new iPad Pro brought us some fantastic improvements to the Apple Pencil. One of those improvements was the ability for the Apple Pencil to recognize simple gestures. Today we'll look at how to work these in our code. Let's dive in! ?‍♀️ First, let's cover the new system-level options for Apple Pencil. If we pair an Apple Pencil with our new iPad Pro by attaching it to the new magnetic inductive charger on the edge, we'll see a new item in our Settings.app for the Pencil. Apple has provided a way for us to read these settings inside our own apps. This is through ..read more
Visit website
Weekly Sponsor: Nevercode ??
Little Bites of Cocoa
by
3y ago
We're welcoming a brand new sponsor this week, it's Nevercode! Continuous integration can be one of the best ways to build solid mobile apps. Nevercode delivers an awesome implementation of it for iOS, Android, Cordova, Ionic, React Native, and even Flutter-based mobile apps. Nevercode enables developers to build, test and deploy native and cross-platform mobile applications automatically without any human interaction or any configuration headaches. Setting up a new project is easy thanks to Nevercode's awesome automatic configuration functionality. Nevercode will build our project for every ..read more
Visit website
#318: Codable Enums ?
Little Bites of Cocoa
by
3y ago
In Bites #316 and #317, we began looking at Swift's new Codable (Encodable & Decodable) protocols. Today we'll continue by learning more about how Swift Enums work can work with these protocols. Let's get started. First off, lets try a basic example. Here's an enum: enum SpaceshipKind { case transport case freighter case fighter } If we simply do this: enum SpaceshipKind : Codable { We'll get an error: Type 'SpaceshipKind' does not conform to protocol 'Decodable'. We can get around this by making our enum a "raw" value type like a String: enum SpaceshipKind : String, Codable { Nic ..read more
Visit website
Weekly Sponsor: Buddybuild ??
Little Bites of Cocoa
by
3y ago
We're very happy to welcome back one of our favorite sponsors again this week. It's buddybuild! Long time readers will remember that buddybuild is a fantastic mobile continuous integration, delivery, crash reporting and feedback platform, all in one. Thousands of development teams, like Slack, Meetup and The Washington Post love buddybuild because it's the easiest way to build, test and distribute their mobile applications. It takes just minutes to set up, let's check it out! We'll head over to buddybuild.com and click Get Started. We'll sign up with Github (we could also use Bitbucket, GitLa ..read more
Visit website
#317: Crafting Great Reverse-DNS Identifiers ?
Little Bites of Cocoa
by
3y ago
Apple platforms make heavy use of "reverse-DNS" identifiers. They appear everywhere from our Application's Identifier all the way down to the Dispatch Queues we create in our code. These identifiers are somewhat opaque in a conceptual sense, and have been around in programming for many years. We create or set them once, and sometimes reference them in our code, but the main idea is that they're a unique, human-readable way to identify some unique "thing". Their nature also offers the benefit of being unlikely to "collide" with one another. The first thing we'll want to define is some kind of t ..read more
Visit website
#316: Codable Dates ?
Little Bites of Cocoa
by
3y ago
In Bite 315 we started looking at the new Codable protocol in Swift 4. Today we'll learn how to work with Date types when encoding and decoding. Let's dive in. We'll start with another simple struct: struct Spaceship : Codable { var name: String var createdAt: Date } Then, we'll create one and encode it into JSON to see what it looks like: let ship = Spaceship( name: "Skyhopper", createdAt: Date() ) let encoder = JSONEncoder() if let data = try? encoder.encode(ship) { print(String(data: data, encoding: .utf8)!) } This prints: { "name":"Skyhopper", "createdAt":524735194.61138701 } Ther ..read more
Visit website

Follow Little Bites of Cocoa on FeedSpot

Continue with Google
Continue with Apple
OR