The Swift Programming Language (by apple)

Swift Alternatives

Similar projects and alternatives to swift

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better swift alternative or higher similarity.

swift reviews and mentions

Posts with mentions or reviews of swift. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-02-02.
  • Adding Union to Swift with Metaprogramming
    4 projects | dev.to | 2 Feb 2023
    The Swift community came up with a couple of implementations of Either — a generic enum that carries one of 2 types associated with it (here, here, and here). There has been a discussion about adding Either to the Standard Library. Still, it seems we’re not going to have it in the foreseeable future because adding disjunctions (logical XORs) in type constraints is a commonly rejected evolution proposal. Funny enough, Apple has an internal implementation of Either in their standard library, but they are not sharing it with us ¯\_(ツ)_/¯
  • Swift Achieved Dynamic Linking Where Rust Couldn't
    10 projects | news.ycombinator.com | 29 Jan 2023
    They are exactly the same except for when they're not.

    (On 64-bit) Rust very naively has two 64-bit integers for the strong and weak count, Swift packs them into only one. Swift also packs in several extra flags for various things [0].

    These flags mean that retain/release (increment/decrement) is actually an atomic compare-and-swap instead of a fetch-add. Allegedly performance issues with this were fixed by the hardware team, just, optimizing CASes better.

    Swift also has to interop with ObjC "weak" pointers which have move constructors because their address is registered with a global map which is used to null them out when all strong counts go away, but I don't think this changes the design much when not using them.

    Swift ARC is built into the language and a huge amount of the compiler's energy is dedicated to optimizing it. This is why it's part of the calling convention (+1/+0), why there are special getter/setter modes with different ARC semantics, why many stdlib functions are annotated with "this has such-and-such semantics" and so on.

    Swift ARC is also very pervasive, as basic collections are all ARC-based CoW, all classes are ARC, and I think existentials and implicit boxes also go through ARC for uniformity?

    ARC is also why historically Swift gave itself fairly extreme leniency on running destructors "early" based on actual use [1]. Eliminating a useless +1 can be the difference between O(n) and O(n^2) once CoW gets involved!

    By contrast in Rust it's "just" a library type which you have to clone/drop (increment/decrement) manually. It doesn't do anything particularly special, but it's very predictable. The existence of borrows in Rust lets you manually do +0 semantics without having to rely on the compiler noticing the optimization opportunity, although you do need to convince the borrow checker it's correct.

    [0]: https://github.com/apple/swift/blob/3b00177f768b630a8f7a1135...

    [1]: https://forums.swift.org/t/a-roadmap-for-improving-swift-per...

  • Why I selected Elixir and Phoenix as my main stack
    36 projects | dev.to | 21 Jan 2023
  • UIKit on Windows?
    2 projects | reddit.com/r/swift | 13 Jan 2023
    Note that the screenshot you shared is from an old (and AFAICT abandoned) port of Swift based upon MinGW. You should look to https://swift.org for the official releases for Windows which are more current.
  • Apple Announces Full Swift Rewrite of the Foundation Framework
    5 projects | news.ycombinator.com | 11 Jan 2023
    `Array` is defined in the Swift standard library, but the compiler knows about the type directly, and also recognizes various @_semantics("array.blah") annotations that appear in the standard library source code.


    5 projects | news.ycombinator.com | 11 Jan 2023
    It's written in C++ although there is some Swift in it now [1]. The compiler doesn't depend on Foundation though.

    [1] https://github.com/apple/swift/tree/main/SwiftCompilerSource...

  • Getting started with Swift-C++ interop
    2 projects | dev.to | 14 Dec 2022
    CppInteroperability folder in the Swift repo contains more information on interop features, limitations and plans.
  • -🎄- 2022 Day 5 Solutions -🎄-
    263 projects | reddit.com/r/adventofcode | 4 Dec 2022
    It does exist, for RangeReplaceableCollection.
  • -🎄- 2022 Day 4 Solutions -🎄-
    230 projects | reddit.com/r/adventofcode | 3 Dec 2022
    Good job, but ClosedRange.contains and .overlaps are in the standard library.
  • SwiftUI Is Convenient, but Slow
    7 projects | news.ycombinator.com | 28 Nov 2022
    According to https://github.com/apple/swift/blob/6d2a3bbf9d518c2ff8c63731...

    > The Swift language contains a number of features not part of the Hindley-Milner type system, including constrained polymorphic types and function overloading, which complicate the presentation and implementation somewhat. On the other hand, Swift limits the scope of type inference to a single expression or statement, for purely practical reasons: we expect that we can provide better performance and vastly better diagnostics when the problem is limited in scope.

    However Hindley-Milner systems are generally linear in complexity whereas Swift's type system experiences combinatorial complexity explosions in the presence of overloads and operators and literals.

  • A note from our sponsor - Sonar
    www.sonarsource.com | 3 Feb 2023
    Sonar helps you commit clean C++ code every time. With over 550 unique rules to find C++ bugs, code smells & vulnerabilities, Sonar finds the issues while you focus on the work. Learn more →


Basic swift repo stats
7 days ago
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives