Archive for April 3, 2023

Monday, April 3, 2023

Swift 5.8

Alexander Sandberg:

Swift 5.8 enables you to start incrementally preparing your projects for Swift 6 by using upcoming features. By default, upcoming features are disabled. To enable a feature, pass the compiler flag -enable-upcoming-feature followed by the feature’s identifier.

[…]

The result builder implementation has been reworked in Swift 5.8 to greatly improve compile-time performance, code completion results, and diagnostics. The Swift 5.8 result builder implementation enforces stricter type inference that matches the semantics in SE-0289: Result Builders, which has an impact on some existing code that relied on invalid type inference.

[…]

SE-0365:

As of SE-0269, implicit self is permitted in closures when self is written explicitly in the capture list. We should extend this support to weak self captures, and permit implicit self as long as self has been unwrapped.

Paul Hudson:

In this article I’m going to walk you through the most important changes this time around, providing code examples and explanations so you can try it all yourself.

Previously:

Xcode 14.3

Apple:

Clang and the build system support a new mode for building module dependencies called explicit modules which improves build performance, reliability, and correctness. The new mode is opt-in, and can be enabled by setting _EXPERIMENTAL_CLANG_EXPLICIT_MODULES as a user-defined build setting in C and Objective-C projects which build with modules enabled.

[…]

Xcode now prompts a user prior to performing a clean action. This prompt can be bypassed by holding the option key while performing a clean, or by permanently hiding the prompt by enabling the “Don’t Ask Me” setting within the prompt.

[…]

Run scripts in a scheme’s pre-actions and post-actions for the Build section now cause the build to fail if any run script exits with a non-zero exit code, instead of reporting a false-positive successful build.

[…]

When a pre-build scheme action (such as compiling a package plugin) encounters an error, the status message at the top of Xcode’s workspace window sometimes doesn’t update. This leaves the previous status showing, possibly causing confusion if the previous status was “Build Succeeded.”

[…]

Xcode automatic signing now creates managed provisioning profiles for Developer ID. This resolves an issue that caused Xcode to throw an error when cloud signing with a Developer ID certificate during the app distribution workflow.

[…]

The timeout argument of XCTestCase.wait(for:timeout:enforceOrder:) and related methods is now optional—if you don’t specify it, the function waits indefinitely (until the overall test times out.) To ensure reasonable execution time, set an appropriate value for the executionTimeAllowance property of the running XCTestCase instance (self).

The extra pieces can be downloaded here, though the Additional Tools are still only at RC status.

The two main changes I noticed are that there’s now an annoying animation when I use Open Quickly… and that tests now need a deployment target of macOS 12. This created a bunch of work silencing deprecation warnings, which is kind of silly because the code being tested runs on macOS 10.13 and so can’t depend on the newer APIs, anyway.

I had to turn off the new module verifier because it warned about double-quoted includes even though I had turned off that warning. (I use such includes to be able to use the same file both in a framework and when I want to include a few individual files in a standalone binary.)

Heath Borders:

TIL Xcode 14.3 Beta isn’t supported under Rosetta. This means that if your iOS project uses x86 libraries, you won’t be able to run the project on an x86 iOS Simulator on an arm64 mac anymore.

You’ll either have to go back to an x86 mac to run your project or you’ll have to add arm64 slices to your libraries.

Jonathan Grynspan:

New in Xcode 14.3: if you’re using XCTestExpectation or XCTWaiter from an async Swift function, you’ll get warnings when using wait(for:timeout:) because that synchronous function may deadlock. Switch to fulfillment(of:) instead for maximum Swiftiness!

Christian Selig:

If Xcode 15 released and the only feature was it was cured of hallucinating ghost errors I would stand up out of my chair and clap.

With the last several releases of Xcode, I’ve seen a lot of fake errors, as well as problems with builds not working properly unless I manually clean the folder first. The Swift compiler still crashes every day.

Nick Lockwood:

PSA: If you’re an Apple dev who hasn’t updated to Ventura for whatever reason, the usual trick of editing the Minimum system version in the Xcode 14.3 Info.plist seems to get it running just fine on Monterey.

Previously:

Update (2023-04-07): My experience so far is that Xcode 14.3 massively increases the number of fake compiler errors, and I’m also getting all sorts of weird crashes when running tests that go away if I clean the build folder. My guess is that there’s something wrong with the dependency tracking so that some files are not being recompiled, and the mismatch between old and new code interacting is causing crashes as well as unexpected test failures.

Kurt:

I have to build multiple times to see failures in Xcode 14.3. First build: failed, but no errors are shown. Second build: failed, errors are show for a few seconds then go away. Rinse and repeat until you can find the errors.

Update (2023-04-21): Christian Beer:

Xcode, I love you too…

Brent Simmons:

I can’t upload NetNewsWire to Apple’s notarization service using Xcode 14.3 — Xcode complains about the profile not complaining a Game Center entitlement.

Sure. For obvious reasons.

But! I had kept a copy of Xcode 14.2, as you do, and it worked perfectly.

Martin Pilkington:

Sooo… I just discovered the latest version of Xcode may have fixed a compiler issue that was kneecapping my M1 Ultra.

There was an issue where on certain projects my Mac Studio would be as fast as my Intel iMac and SLOWER than an M1 MBP. The reason? Too many cores. If I limited to 4 cores it was faster than 20 (as in 90s vs 150-200s).

Just did a clean build today and… 20-30s. My Studio FINALLY feels as fast as it should! 😭

Gus Mueller:

A change in compilers (whatever clang was in Xcode 14.0 vs. 14.3) + a more aggressive ARC memory release surfaced a stupid little bug in Acorn that nobody would have seen but me. It was caught in regression tests, and I was super confused for a long time, but … yay compilers getting smarter / faster / whatever?

Marcel Weiher:

Anyone else have Xcode 14.3 beach balling constantly?

Seems to be hanging on some XPC thing to do with text input?

This has happened to me several times. I’m also seeing hangs when I’m away from the office and it tries to check the source control status of a file but can’t reach the server on my LAN.

Previously:

Update (2023-05-01): Paul Haddad:

Anyone run into problems with Xcode 14.3 not auto-creating a proper CFBundleIcons~ipad entry? 14.2 doesn’t create it for simulator builds, but does create it for Archive. 13.4.1 creates it all the time.

Driving me nuts.

Aaron Czichon:

Xcode 14.3 has many problems. Also doesn’t work correctly in any CI/CD environment. Throwing random errors which are not related to the actual error. Need to downgrade to Xcode 13.x everything to get the real error. Driving me nuts.

I’ve been much happier since downgrading to 14.2, though it still shows lots of spurious errors.

Twitter’s Recommendation Algorithm

Twitter (Hacker News, Slashdot):

At Twitter 2.0, we believe that we have a responsibility, as the town square of the internet, to make our platform transparent. So today we are taking the first step in a new era of transparency and opening much of our source code to the global community.

[…]

We also took additional steps to ensure that user safety and privacy would be protected, including our decision not to release training data or model weights associated with the Twitter algorithm at this point.

Twitter (tweet, Hacker News):

Twitter aims to deliver you the best of what’s happening in the world right now. This requires a recommendation algorithm to distill the roughly 500 million Tweets posted daily down to a handful of top Tweets that ultimately show up on your device’s For You timeline. This blog is an introduction to how the algorithm selects Tweets for your timeline.

[…]

The foundation of Twitter’s recommendations is a set of core models and features that extract latent information from Tweet, user, and engagement data. These models aim to answer important questions about the Twitter network, such as, “What is the probability you will interact with another user in the future?” or, “What are the communities on Twitter and what are trending Tweets within them?” Answering these questions accurately enables Twitter to deliver more relevant recommendations.

The recommendation pipeline is made up of three main stages that consume these features: 

  1. Fetch the best Tweets from different recommendation sources in a process called candidate sourcing.
  2. Rank each Tweet using a machine learning model.
  3. Apply heuristics and filters, such as filtering out Tweets from users you’ve blocked, NSFW content, and Tweets you’ve already seen.

The (mostly Scala) code is here.

Dan Luu:

The new stuff in the Twitter algorithm is wild.

“author_is_elon”, “author_is_republican”, “author_is_democrat”, etc., are explicit terms that are special cased.

Aakash Gupta:

  1. Likes, then retweets, then replies

    Here’s the ranking parameters:

    • Each like gets a 30x boost
    • Each retweet a 20x
    • Each reply only 1x

    It’s much more impactful to earn likes and retweets than replies.

  2. Images & videos help

    Both images and videos lead to a nice 2x boost.

  3. Links hurt, unless you have enough engagement

    Generally external links get you marked as spam.

Stephen Hackett:

There were some very funny things in there that have now been deleted, but as of this writing, this one remains, as does one requesting a printed version of the repository.

Mysk:

What is this WTF thing that Twitter's algorithm refers to?

Mysk:

Things no longer restricted on Twitter

Update (2023-04-04): Mysk:

Oh, the number of unfollows might result in “shadow-banning” a Twitter account. The Twitter algorithm shadow-bans an account based on these 5 negative signals:

1- Blocks
2- Mutes
3- Abuse reports
4- Spam reports
5- Unfollows

Update (2023-04-24): Arvind Narayanan (via Hacker News):

It turns out to be a standard engagement prediction algorithm of the kind most major platforms use; I explained how these algorithms work in a recent essay. The source code release makes for an interesting case study of social media transparency. Let’s talk about what the code does and doesn’t reveal, from the perspective of trying to understand information propagation and algorithmic amplification on social media.

New Twitter API Tiers

Twitter (tweet):

We will offer two access tiers for developers via our website:

Free

For write-only use cases with the Twitter API

  • Low rate-limit access to v2 tweet posting and media upload endpoints
  • 1,500 Tweets per month posting limit - at the app level
  • 1 app ID
  • Login with Twitter
  • Cost: Free

Basic

For hobbyists & prototypes

  • Low-rate limit access to suite of v2 endpoints
  • 3,000 Tweets per month - posting limit at the user level
  • 50,000 Tweets per month - posting limit at the app level
  • 10,000 Tweets per month read-limit rate cap
  • 2 app IDs
  • Login with Twitter
  • Cost: $100 per month

Going by the stated goal of stoppings bots, this doesn’t make a lot of sense. The write-only tier is free, but you have to pay to read. For the pricing, $100/month is a lot for a hobbyist. It’s reasonable for a paid service that helps you read tweets, but the limits are so low as to be useless. A cap of 10K tweets—not even API calls, tweets—is just too limiting. Twitter really wants you to use their clients.

Andrew Wooster:

Just for reference, back in the day when there were like 14 people at Twitter they gave my account a 50,000 req/day limit for free.

Paul Haddad:

They totally disabled access to the V1.1 API (probably because they had no one that could implement these limits on it).

[…]

The sign up link for the Enterprise API, you know the thing that costs $42k/month, is just a Google Form doc…

In the Enterprise sign up form they make it seem like the Enterprise APIs don’t change. The Enterprise API aren’t a superset of the V1.1/V2 API, they’re fairly different and limited in scope.

So what happens to the hundreds of companies who need more access than the crap-o level provides? IFTTT, ZenDesk, Buffer, Block Party, etc…

Ben Ubois:

Feedbin’s Twitter access was revoked because “this App has violated Twitter Rules and policies.” Which is the same message many Twitter clients received in January when Twitter first started turning off API access. […] This means the end of Twitter support in Feedbin.

Brent Simmons:

We’ll have till the end of April, it looks like, before we have to turn off Twitter integration in NetNewsWire.

Manton Reece:

For Micro.blog, we plan to support cross-posting for a limited number of months, to let folks wind down their use of Twitter. There’s no future on Twitter so all we can do is smooth over the shutdown for customers.

Dave Winer:

Every developer who built on Twitter has had to make a decision about what to do as their API is changing in the next few days.

Here’s my plan. I’m not going with them. If the API changes break my software, so be it. We had a good run.

Ryan Barrett (via Hacker News):

I’d just like to draw your attention to this page that shows Twitter employees’ posts here on this forum, in chronological order, descending.

Before December, a large number of employees posted here regularly on a wide range of topics. Over the last few months, only a single Twitter employee has posted here consistently, and only about the Ads API.

[…]

I conclude that the Twitter API is now effectively unmaintained. I expect the company will only touch it when they get a misguided edict from the top – for example, the upcoming free API lobotomy. When that happens, I expect it will be done by engineers from the other side of the org, who don’t know the code or systems much or at all, and will probably break more than they “fix.”

Previously: