What is a JSON feed? Learn more

JSON Feed Viewer

Browse through the showcased feeds, or enter a feed URL below.

Now supporting RSS and Atom feeds thanks to Andrew Chilton's feed2json.org service

CURRENT FEED

Stuart Breckenridge

Indie app developer.

A feed by Stuart Breckenridge

JSON


The Collatz Conjecture: Revisited

Permalink - Posted on 2020-01-16 14:00

I was digging through some of the older posts on this site and I came across the The Collatz Conjecture. I wrote it around four years ago, during the Swift 2.2 days. I thought I’d try making it a bit more efficient. As a reminder, here’s the problem statement:

  • create an array to capture the sequence of numbers returned by the Collatz function1.

My original solution was 21 lines of code. The new solution I’ve come up with is just under half of that and just as expressive (I think).

The gist:

  • Extend Array when the only elements are UnsignedIntegers with a new mutating function, called collatzify.
  • The collatzify function will check if the array is empty (1), and will do nothing if it is
  • If the only value in the array is 1, the function mutates the array to [1,4,2,1] (2)
  • Otherwise, while the last element in the array isn’t 1, the function recursively adds to the array by applying the collatz function to the last element. (3)
extension Array where Element: UnsignedInteger {
    
    /// Takes the last value in the array and then populates the rest of the collatz sequence.
    mutating func collatzify() {
        if !self.isEmpty { // 1
            if self.count == 1 && self.last == 1 {
                self = [1,4,2,1] // 2
            } else {
                while self.last != 1 {
                    self.append( self.last! % 2 == 0 ? self.last! / 2 : (self.last! * 3) + 1) // 3
                }
            }
        }
    }
    
}

// Usage:
var sequence:[UInt] = [7]
sequence.collatzify() // [7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1]

Performance wise—as measured by XCTestCase—this solution is over 90% faster that the original: 0.000017s vs. 0.000388s.

  1. The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: start with any positive integer n. Then each term is obtained from the previous term as follows: if the previous term is even, the next term is one half the previous term. If the previous term is odd, the next term is 3 times the previous term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.—Wikipedia ↩︎


Spotify Launches Playlists for Pets

Permalink - Posted on 2020-01-15 14:32

Mitchel Broussard, for MacRumors:

Spotify today announced “Pet Playlists,” which builds custom playlists for a cat, dog, iguana, hamster, or bird (via The Verge). The playlist generator combines your pet’s personality traits with your own listening history on Spotify, building a list of songs that the company says both you and your pet can enjoy.

This reads like a headline from The Day Today.


NYT: You're Being Tracked (And We're At It To)

Permalink - Posted on 2020-01-04 03:30

One Nation, Tracked is an astonishing report from Stuart A. Thompson and Charlie Warzel for The New York Times Privacy Project. It details how they were able to use one dataset to track the location of 12 million Americans and then connect what is supposed to be non-identifable data to real people.

The companies that collect all this information on your movements justify their business on the basis of three claims: People consent to be tracked, the data is anonymous and the data is secure.

None of those claims hold up, based on the file we’ve obtained and our review of company practices.

Yes, the location data contains billions of data points with no identifiable information like names or email addresses. But it’s child’s play to connect real names to the dots that appear on the maps.

Here’s the problem, though: by reading this article I, along with anyone else not using some form of ad-blocker or VPN, are likely being tracked as well. The site is rife with trackers. Browsing the article with Ghostery enabled reveals the following:

  • 3 advertising trackers (Media.net, Amazon Associates, and DoubleClick)
  • Google Tag Manager
  • 3 site analytics trackers (Google Analytics, Optimizely Geographical Targeting, and Optimizely)
  • 2 unknown trackers (The New York Times, Optimizely)

How does the NYT square away their in-depth reporting of privacy violations while being complicit in those same violations? With this generic statement at the bottom of the article:

Like other media companies, The Times collects data on its visitors when they read stories like this one. For more detail please see our privacy policy and our publisher’s description of The Times’s practices and continued steps to increase transparency and protections.

Reading the privacy policy is illuminating. Through technologies such as cookies, web beacons, tags and scripts, software development kits (or SDKs) and beyond, the NYT will log everything from your IP address and location to your device identifier. If you go further down the rabbit hole and follow the link to view the cookie policy you will find that there are 12 different cookie policies.

It’s unlikely most people will read the privacy policy. It’s even more unlikely that they will read any of the cookie policies. They are lengthy, dry, and written in legalese. Perhaps the NYT is hoping we’ll just look the other way and not hold them to a higher standard?


An Equivalent to Jailbreaking

Permalink - Posted on 2019-12-03 14:10

Tim Hardwick, at MacRumors:

Russian President Vladimir Putin today signed new legislation requiring all smartphones, computers, and smart TVs sold in the country to come pre-installed with Russian software, reports Reuters.

Responding to today’s news of the law, an unnamed Apple source reportedly told the Kommersant business daily: “A mandate to add third-party applications to Apple’s ecosystem would be equivalent to jailbreaking. It would pose a security threat, and the company cannot tolerate that kind of risk.”

Apple has to draw a line in the sand. This isn’t a 50:50 decision: once you compromise your platform for one authoritarian regime, you might as well do it for them all.


Is It One of Those Weeks?

Permalink - Posted on 2019-10-29 12:53

Back in March, Apple released new iPads on March 18th, a new iMac on March 19th, and second generation AirPods on March 20th.

Is this another one of those weeks?

AirPods Pro were released yesterday along with iOS 13.2. However, AirPods Pro require macOS 10.15.1, as noted on the Apple NewsRoom website:

AirPods Pro require Apple devices running iOS 13.2 or later, iPadOS 13.2 or later, watchOS 6.1 or later, tvOS 13.2 or later, or macOS Catalina 10.15.1 or later.

macOS 10.15.1 has still not been released. My guess is that it is coming later today (as AirPods Pro will arrive later this week), along with pre-orders for:

  • a new 16-inch MacBook Pro
  • the Mac Pro
  • new charging cases for the iPhone 11 range

At a stretch, maybe the rumoured AirTags will be announced?


A .Mac Apple ID and Sign in with Apple

Permalink - Posted on 2019-10-17 14:40

The story of my Apple ID:

  • It was a @mac.com email address created in the days of .Mac
  • I let the .Mac subscription expire before the transition to MobileMe
  • When signing into Mail on the Mac, I created an @icloud.com address for my Apple ID
  • This became Primary Email Address for my Apple ID

This chain of events created a problem with both my Apple ID and Sign in with Apple.

First, the Apple ID website wouldn’t let me change my Apple ID from @mac.com to the @icloud.com address. In fact, despite the option to change my Apple ID being available, when I attempted to change it the website froze.

Second, as a result of the above, when using Sign in with Apple I had no way to resolve the following problem using the Hide my email address option:

  • Only the @mac.com address was available; and,
  • Signing in always failed; and,
  • The failure reason was never given1

The only available solution to this problem? Raise a support ticket with Apple and ask them to replace your Apple ID with your Primary Email Address.

It took nine days for this change to be made on my account, and an escalation to Engineering, but it has solved all of the above problems.2

  1. A failure reason wasn’t presented to the user or via the delegate to the developer. ↩︎

  2. When the change was made all my devices started asking for my password at once. ↩︎


Apple Card Found to Contain 90% Titanium and 10% Aluminium

Permalink - Posted on 2019-09-03 14:15

Joe Rossignol, for Macrumors:

Bloomberg Businessweek sent an Apple Card to University of California, Berkeley professor and mineralogist Hans-Rudolf Wenk to determine the card’s atomic makeup. The answer: 90% titanium and 10% aluminium.

Not to nitpick, but this is probably the least rumoury article on Macrumors. It is an actual fact about the atomic makeup of an actual physical product.

P.S. I corrected the spelling of aluminium.


Singapore Transit Summer Update

Permalink - Posted on 2019-08-11 12:00

Singapore Transit is undergoing some major changes in order to support iOS 13 and watchOS 6.

The nearby bus stops, bus arrivals, and MRT/LRT service status views have all seen some level of redesign. The Traffic Incident screen has been completely redesigned. Typography has been refreshed throughout, accessibility support has been improved further, and the app supports both light and dark mode. Finally, database updates — new bus stops and routes — are now delivered in the background rather than through updates via the App Store.

The Watch app that shipped with v1 and v2 has been…deleted. It is currently in the process of being rebuilt from scratch using SwiftUI1. The plan is for it have, as far as possible, feature parity with the iOS app.

The next version of Singapore Transit will also switch to date based versioning. The first version will be Singapore Transit 2019, then 2019.1, and so on. This is for simplicity more than anything else.

When’s all this coming?

I’m targeting late October. This should give the majority of current users enough time to upgrade to iOS 13 and watchOS 6, which will be the minimum supported versions.

  1. This has hit a slight delay as TestFlight doesn’t seem to support builds that use Combine. I’ve raised a feedback incident: FB6992845. ↩︎


Lucky Dip with SwiftUI and Combine

Permalink - Posted on 2019-06-13 14:41

My first iPhone app — in hindsight, my first UIKit app — was called Lucky Dip, and I released it about eight years ago. It was a little utilty that helped you pick lottery numbers for four different lottery games available in the UK.

Lucky Dip

With last week’s introduction of SwiftUI and Combine at WWDC, I thought I’d build a new version of Lucky Dip to get some experience with these new technologies.

It turns out it didn’t take too long and it’s pretty much done.

Lucky Dip with SwiftUI

I’ll be putting the source code on GitHub soon.


WWDC 2019 Wish List

Permalink - Posted on 2019-05-28 13:15

It’s very close to that time of the year when all our Swift code breaks we get lots of new API to play with. Below is my work in progress list of features I’d like to see.

MapKit

  • Dark mode for maps. If there is to be a dark mode for iOS system-wide, I’d like an API that allows me to give the user a controllable dark mode for UIMapView.
  • Access to transit overlays. At the moment transit overlays, e.g. bus routes or MRT lines, are not available via any public API.
  • Snap to roads. Give developers an option to snap an MKPolyline to a road.
  • Increased direction request limit. You can currently get directions for up to 50 waypoints before you are rate limited. When calculating bus routes there are usually more than 50 waypoints, so that means using a less accurate MKPolyline to represent the route. This could be negated by giving access to transit overlays.

Alternative Icons

  • Alternative icon management. Move alternative icons to the asset catalog and remove the need to configure via Info.plist.

GameKit

  • Refresh the whole thing. GameKit has been neglected for so long. The documentation hasn’t been updated in over three years and there aren’t, as far as I can tell, any Swift code samples. It’d make sense for Apple, given their new focus on games, to really revamp GameKit.

Xcode

  • Storyboard performance. Make this faster, please.
  • Customisations. Via Becky Hansmeyer:

    every visual customization that is possible for a UI component should be editable in Interface Builder

  • SourceKit. LSP
  • Navigation. Clearer UI for different targets within the Navigator area.

Font Management

  • Asset catalog. Put fonts in the asset catalog and remove the need to configure embedded fonts via Info.plist.

Analytics

  • Framework. A first-party, privacy focused analytics framework, to challenge Firebase and App Center.


Singapore Transit v2.2.5

Permalink - Posted on 2019-05-24 22:51

This patch release updates Singapore Transit with new bus stops and bus routes and is available on the App Store now.


MacBook Pro 2019

Permalink - Posted on 2019-05-21 22:47

Chance Miller, 9to5Mac:

Apple has announced today that it is upgrading the MacBook Pro with faster 8th- and 9th-generation Intel Core processors. This revision marks the first time that the MacBook Pro has been available in an 8-core configuration. The new MacBook Pro models also feature a revised keyboard design.

[…]

In addition to the faster processors, Apple says the new MacBook Pros feature a new iteration of its Butterfly keyboard technology. Apple is including the new keyboard on the new 13-inch and 15-inch MacBook Pros released today. Apple didn’t offer any details on whether or not the new keyboard design would also make its way to other Butterfly keyboard Macs, such as the MacBook Air.

In addition, Apple is expanding its keyboard-replacement program. Joanna Stern, for the Wall Street Journal:

Apple on Tuesday said it was changing a material used in its butterfly keyboards and expanding its keyboard-repair program. The program previously covered first- and second-generation keyboards, but now includes coverage of the third-generation keyboards introduced last year on MacBook Air and high-end MacBook Pro models.

The fact that all butterfly keyboards, from first-gen through to today’s redesign, are covered by the replacement program is a good thing. However, it doesn’t fill me with confidence that Apple has got to the bottom of what’s making the keyboards so unreliable.


Becky Hansmeyer: WWDC 2019 Developer Wishlist and Keynote Predictions

Permalink - Posted on 2019-05-20 22:50

Via Becky Hansmeyer’s WWDC 2019 Wishlist:

stop making us […] write dumb hacks like adding a blank UIImage as a navigation bar’s “shadow” just to get rid of that line beneath it

I used to do this for Singapore Transit and it was incredibly annoying. However, a simpler approach is available (though still not ideal):


navigationController?.navigationBar.setValue(true, forKey: "hidesShadow")

That said, I think UINavigationBar does need to have support added for multi-line title labels in both normal and large title mode.


Powerbeats Pro Not Available Until June in Singapore

Permalink - Posted on 2019-05-19 07:50

Joe Rossignol, Macrumors:

While the black Powerbeats Pro remain listed as “coming soon” on Apple’s online store elsewhere, recently updated fine print on the Beats website indicates that the earphones will begin their worldwide rollout later in May and June.

Powerbeats Pro will be available to pre-order in black later in May in the United Kingdom, France, and Germany, followed by Australia, Singapore, China, Japan, Hong Kong, Korea, Austria, Italy, Spain, Ireland, The Netherlands, Belgium, Russia, Switzerland, Sweden, Mexico, and Brazil in June, according to the fine print.

Not great as I wanted to buy them before this year’s Sundown Marathon.1

  1. My left AirPod only lasts about 40 minutes on a full charge these days. That’s barely long enough to get through about a 7km run. ↩︎


Singapore Transit v2.2.0

Permalink - Posted on 2019-03-18 14:31

This version of Singapore Transit includes database and privacy policy updates.


The Boeing 737 Max has Crucial Safety Equipment Sold as an Optional Extra

Permalink - Posted on 2019-03-14 00:19

Essential reading from Jon Ostrower, at The Air Current:

Lion Air 610 should never have been allowed to get airborne on October 29, a conclusion shared by those familiar with the inquiry. The plane simply wasn’t airworthy. According to the preliminary investigation, PK-LQP’s Angle of Attack sensors were disagreeing by 20-degrees as the aircraft taxied for takeoff. A warning light that would’ve alerted the crew to the disagreement wasn’t part of the added-cost optional package of equipment on Lion Air’s 737 Max aircraft.

It’s staggering to me that any safety feature is sold as an optional extra.


We Can't Blame the EU for This

Permalink - Posted on 2019-03-13 23:00

Polly Toynbee, for The Guardian:

At least May spelled out one useful warning. When everything collapses around their ears, when Brexit proves a calamity, “It will be no good blaming the EU, responsibility would lie with this House.” And so it would – unless this House can pull back, revoke article 50 with a confirmatory public vote, and try to dismiss this whole desperate episode as a brief strange nightmare that history should forget.

The Leave Campaign also shoulders a degree of responsibility for lying.

Regardless, now that the public has an understanding of the costs and implications of leaving the bloc, a confirmatory vote is the only logical, fair way forward.


Thunderbolt 3 and USB to Converge Under USB 4.0

Permalink - Posted on 2019-03-04 15:46

Joe Rossignol, via Macrumors:

USB4 converges the Thunderbolt and USB protocols as part of Intel’s goal to make Thunderbolt available on a royalty-free basis, which should result in wider and cheaper availability of Thunderbolt accessories like docks and eGPUs.

The USB4 specification is on track to be published around the middle of 2019. Over 50 companies are actively participating in the final stages of review of the draft specification, which should include Apple, Intel, and Microsoft, but it might take a few years until the first USB4 devices are released.

USB4 is Thunderbolt 3. As such, I don’t think it’ll take as long as a few years before we see USB4 devices.


The USB 3.x Renaming Mess

Permalink - Posted on 2019-02-28 14:54

Juli Clover, for Macrumors:

Going forward, USB 3.1 Gen 1 (transfer speeds up to 5Gb/s), which used to be USB 3.0 prior to a separate rebranding, will be called USB 3.2 Gen 1, while USB 3.1 Gen 2 (transfer speeds up to 10Gb/s) will now be known as USB 3.2 Gen 2.

What used to be considered USB 3.2 will now be USB 3.2 Gen 2x2 because if offers twice the throughput speeds of USB 3.1 Gen 2, now USB 3.2 Gen 2. If that sounds confusing to you, you’re not alone. Tom’s Hardware made this handy chart that shows the new branding scheme compared to the older branding.

If the swap between USB 3.1 Gen 1 and Gen 2 to USB 3.2 wasn’t confusing enough, each of these specifications also has a marketing term. The new USB 3.2 Gen 1 with transfer speeds up to 5Gb/s is SuperSpeed USB, while USB 3.2 Gen 2 with transfer speeds up to 10Gb/s is known as SuperSpeed USB 10Gbps. The USB 3.2 Gen 2x2 specification with transfer speeds up to 20Gb/s is known as SuperSpeed USB 20Gbps.

This is just crazy:

  • USB 3.1 Gen 1 (now USB 3.0 & SuperSpeed USB)
  • USB 3.1 Gen 2 (now USB 3.1 & SuperSpeed USB 10Gbps)
  • USB 3.2 (still USB 3.2 & SuperSpeed USB 20Gbps)

The USB-C connector on my MacBook Pro supports 40Gbps through Thunderbolt 3 and 10Gbps through USB 3.11. I had to dig through the tech specs to work that out. It’s absolutely user hostile.

  1. USB 3.1 Gen 2 ↩︎


Apple Isn’t the Only Casualty of China's Slowdown

Permalink - Posted on 2019-01-03 06:30

Angus Whitley, for Bloomberg:

FedEx: The U.S. delivery giant slashed its profit forecast in late December – just three months after raising it. While FedEx Corp.’s woes weren’t limited to China, the company cited trade tensions, especially between the U.S. and China, among its troubles.

Starbucks: But last month, Starbucks Corp. said sales growth in China could be as low as 1 percent in the long term. That’s slower than the 3 percent to 4 percent growth seen for the U.S. and the rest of the world. It’s not clear how much China’s economy or trade tensions are to blame – or if China is just losing its taste for caffeine.

Tiffany’s: China’s economic woes are more of a headache for the jeweller outside the country than inside. In November, Tiffany & Co. reported weaker-than-expected sales and highlighted a “clear pattern” of Chinese shoppers cutting back on spending when they’re overseas.

Daimler: The German maker of Mercedes cars was among the first global brands to blame escalating trade tensions when it warned in June that retaliatory tariffs in China on car imports from the U.S. would hit sales on the mainland.

Trade wars: good for no-one.