Site IconFunclosure
HomeAboutDev NotesBlogProjects
  • Intro
  • SwiftUI
    • Custom Style in Swiftui
    • Learning Swift
    • Swiftly Coding
    • Working with String
    • Copy-on-Write Semantics
    • Swift Tips
  • Mobile Architecture
    • Unified ViewModel for UIKit and SwiftUI
    • Make Desktop Your Workspace

On This Page

  • Remove Duplicates in Array
Dev NotesSwiftSwift Tips

Swift Tips

DevSwiftData Structures & Algorithms

Remove Duplicates in Array

public extension Array where Element: Hashable {
    func uniqued() -> [Element] {
        var seen = Set<Element>()
        return filter { seen.insert($0).inserted }
    }
}

https://stackoverflow.com/a/46354989/4162542

Copy-on-Write SemanticsMobile Architecture

© 2025 Funclosure. Constantly learning.