NativeSwiftSort

struct NativeSwiftSort : SortMethod

Native Swift sort in Foundation library is Tim sort.

This class here uses it just in the end of the demo, sorting a large array without animation.

One could take the source code for the library implementation and restructure it so that it can be executed step by step as the other sort methods implemented here. Then this could also be animated. This is left as an exercise to the reader.

  • Declaration

    Swift

    init(arraySize: Int)
  • Declaration

    Swift

    let size: Int
  • Declaration

    Swift

    var name: String { get }
  • Declaration

    Swift

    var description: String { get }
  • Declaration

    Swift

    var webLinks: [(String, String)] { get }
  • Step by step execution not implemented.

    Declaration

    Swift

    mutating func restart()
  • Step by step execution not implemented.

    Declaration

    Swift

    mutating func nextStep(array: [Int], swappedItems: inout SwappedItems) -> Bool
  • Just call the usual sort implementation of the library array struct.

    Declaration

    Swift

    mutating func realAlgorithm(array: inout [Int])