@nicklockwood@mastodon.social avatar

nicklockwood

@nicklockwood@mastodon.social

iOS. 3D graphics. Retro games. He/Him.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

nicklockwood, to random
@nicklockwood@mastodon.social avatar

In a fit of madness I've agreed to give an internal talk about advanced Swift at my company. Has anybody got any favorite Swift tricks they'd like to share?

nicklockwood,
@nicklockwood@mastodon.social avatar

@ctietze this is a great tip - also other related for loop syntax quirks like for case let foo as type and where clauses

ctietze, to random
@ctietze@mastodon.social avatar

Objective-C professionals around the world, I summen ye 🗺️

Is there not a way to annotate an Objective-C method that returns a Foundation type like NSString to avoid automatic bridging to Swift.String?

I really want to stay in NSString-land.

(Actually, I probably even want to keep fiddling with an NSMutableString as a mutable string)

nicklockwood,
@nicklockwood@mastodon.social avatar

@ctietze I think that's an easier problem - NSMutableString doesn't bridge, so if you return that it shouldn't be converted to String by default

nicklockwood,
@nicklockwood@mastodon.social avatar

@ctietze otherwise, if you control the signature to the method then there are various (slightly ugly) workarounds I can think of, such as returning NSObject and casting it on the Swift side.

nicklockwood,
@nicklockwood@mastodon.social avatar

@ctietze another option might be to create an objc protocol that mirrors the NSString API and then conform NSString to it. If you work exclusively with that protocol, Swift wouldn't know how to bridge it

nicklockwood,
@nicklockwood@mastodon.social avatar

@ctietze I'm curious: if you call such a method by saying something like

mutableString.substring(…) as NSString

would Swift actually do a two-way bridging, or is the optimizer smart enough to recognize that the bridging is a no-op in that scenario?

ratkins, to random
@ratkins@mastodon.social avatar

I’m pleased you’re all angry about the StackOverflow announcement, I’m not because I couldn’t parse any meaningful information out of the corporate gobbledygook.

nicklockwood,
@nicklockwood@mastodon.social avatar

@ratkins it's unclear to me if they intend to use OpenAI to answer questions on StackOverflow (which will make it basically useless) or just use existing StackOverflow answers to train OpenAI (which should probably bother me, but tbh doesn't really)

airspeedswift, to random
@airspeedswift@mastodon.social avatar

Y’all are putting way too much inside didSet.

I get how temptingly convenient it is but it’s setting things up for future sadness.

Also no taking all that logic and stuffing it in a single method you call from didSet. You’re not fooling anyone.

nicklockwood,
@nicklockwood@mastodon.social avatar

@philip @siracusa @airspeedswift @beccadax in languages like Java where the syntax for calling a getter/setter is different from directly accessing a property, the reason for always using setters and getters is that it means you can change the implementation later (e.g. from a stored to computed property) without changing the interface.

In Swift, where the calling syntax is the same for stored and computed properties, there's no need to worry about it up-front.

nicklockwood,
@nicklockwood@mastodon.social avatar

@siracusa subclassing?! In this economy?

nicklockwood, to random
@nicklockwood@mastodon.social avatar

Me (as the sole swiftformat maintainer) filing an invoice against the swiftformat opencollective project to reimburse myself, and then (as the sole swiftformat opencollective project administrator) approving the invoice

nicklockwood, to random
@nicklockwood@mastodon.social avatar

Whoever designed this church spire must have studied at the school of '90s FPS architecture

nicklockwood,
@nicklockwood@mastodon.social avatar

@layoutSubviews yeah, plus that stock brick texture for the main building was a real cop out

icanzilb, to nature
@icanzilb@mastodon.social avatar
nicklockwood,
@nicklockwood@mastodon.social avatar

@icanzilb Windows XP desktop vibes

ctietze, to random
@ctietze@mastodon.social avatar

Why are the .ASM file comments never aligned properly, ever? 😭

nicklockwood,
@nicklockwood@mastodon.social avatar

@ctietze the arguments aren't aligned either - my guess is different tab display settings (8 spaces vs 4?) from the author?

nicklockwood,
@nicklockwood@mastodon.social avatar

@jsq @ctietze brb, just working on ASMFormat

csilverman, to random

Curious to see how people interpret this pattern. Is the switch on or off?

(I would have done a poll, but apparently you can't have an image and a poll in the same post.)

nicklockwood,
@nicklockwood@mastodon.social avatar
nicklockwood, to random
@nicklockwood@mastodon.social avatar

My daughter had an anxiety dream that we went on vacation somewhere with bad wifi and she lost her duolingo streak 🤣

icanzilb, to random
@icanzilb@mastodon.social avatar
nicklockwood,
@nicklockwood@mastodon.social avatar

@icanzilb I like how they tried to deflect the blame onto (presumably) some hapless individual employee by saying the cause was an unapproved change to the lubricant spec, when really all that demonstrates is that their processes are bad

dave, (edited ) to random
@dave@social.lightbeamapps.com avatar

deleted_by_author

  • Loading...
  • nicklockwood,
    @nicklockwood@mastodon.social avatar

    @dave I think this post could have used a trypophobia warning 😅

    danwood, to swift

    This is pretty fun - in 5.9 and up, with the ability to use case and if statements to assign, you can very tersely express matching to more than one case of an enum. For example:

    nicklockwood,
    @nicklockwood@mastodon.social avatar

    @bealex @danwood another reason is that enum cases are only Equatable by default if they don't have payloads. If any of the cases you were testing for had an associated value then == wouldn't work, whereas this switch pattern still would

    nicklockwood, to random
    @nicklockwood@mastodon.social avatar

    Had a blast meeting up with some of the old gang at NSLondon tonight. It was like a high school reunion but if I'd actually liked the people I went to high school with

    nicklockwood,
    @nicklockwood@mastodon.social avatar

    @matadan I didn't realize you were in London! Oh well - next time!

    ctietze, to random
    @ctietze@mastodon.social avatar

    I don't know why but these macOS styles of yesteryear make the dumbest app look good in screenshots.

    This is a picture of an app showing environment variables passed during launch or via GDB.

    nicklockwood,
    @nicklockwood@mastodon.social avatar

    @ctietze same was true of OG iOS. The stock system style was so elegant that even a simple app with stock components looked acceptable. Now using stock components makes an app look like an unstyled web page.

    Migueldeicaza, to random
    @Migueldeicaza@mastodon.social avatar

    The nice thing about retro games is that they don’t expire - unlike 99% of modern games [1]

    [1] I pulled this number out thin air

    nicklockwood,
    @nicklockwood@mastodon.social avatar

    @Migueldeicaza also, with retro games the developers don't keep remotely tweaking a game that you liked after you bought it and removing content you already paid for until it's no longer a game you like

    nicklockwood, to random
    @nicklockwood@mastodon.social avatar

    I have on more than one occasion used the phrase "don't cross the streams" to refer to mixing potentially incompatible friend groups (e.g. work colleagues and university mates).

    I thought this was a standard use of the idiom, but I can't find any reference to it online (Urban dictionary has some very unpleasant definitions, but not that one) and I'm now wondering if anyone knew what the hell I was talking about when I said it 😅

    nicklockwood,
    @nicklockwood@mastodon.social avatar

    @monocularvision @MuseumShuffle @_Jordan well yeah, exactly. But I can't seem to find any popular reference for this now. All definitions either specifically refer to Ghostbusters, or are weird urine-based sex acts

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • DreamBathrooms
  • cisconetworking
  • khanakhh
  • mdbf
  • magazineikmin
  • modclub
  • InstantRegret
  • rosin
  • Youngstown
  • slotface
  • Durango
  • tacticalgear
  • megavids
  • ngwrru68w68
  • everett
  • tester
  • cubers
  • normalnudes
  • thenastyranch
  • osvaldo12
  • GTA5RPClips
  • ethstaker
  • Leos
  • provamag3
  • anitta
  • lostlight
  • All magazines