harshil,
@harshil@mastodon.social avatar

Littlest Swift pet peeve: I simply cannot declare a variable’s type separately from the default value

🚫 var thing: SomeType = .value
✅ var thing = SomeType.value

mergesort,
@mergesort@macaw.social avatar

@harshil Unless it's [SomeType], then I'll usually do it on the left-hand side.

harshil,
@harshil@mastodon.social avatar

@mergesort Yeah that’s the one exception, for collections literals feel better, both when they’re empty and not

rhysmorgan,
@rhysmorgan@mastodon.social avatar

@harshil @mergesort Definitely necessary for anything other than the most obvious Array assignments. Also useful if you use static methods/are storing enum cases.

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