forked from Dimillian/ACHNBrowserUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Share): improve code of sharing feature (Dimillian#260)
* When trying to work on Dimillian#251, but cannot fix the initial issue. At least these improvements can be merged
- Loading branch information
1 parent
f370cd0
commit 31eb059
Showing
6 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
ACHNBrowserUI/ACHNBrowserUI/extensions/Sequence+Unique.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// Sequence+Unique.swift | ||
// ACHNBrowserUI | ||
// | ||
// Created by Renaud JENNY on 14/06/2020. | ||
// Copyright © 2020 Thomas Ricouard. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
// See tobiasdm answer https://stackoverflow.com/questions/27624331/unique-values-of-array-in-swift | ||
extension Sequence where Iterator.Element: Hashable { | ||
func unique() -> [Iterator.Element] { | ||
var seen: [Iterator.Element: Bool] = [:] | ||
return filter { seen.updateValue(true, forKey: $0) == nil } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters