Skip to content

Instantly share code, notes, and snippets.

@jasdev
Created Feb 20, 2022
Embed
What would you like to do?
Teeing up two dictionaries of tabs.
import Foundation
struct Tab {
let id = UUID()
let url: URL
}
let twitter = Tab(url: URL(string: "https://twitter.com/")!)
let pointFree = Tab(url: URL(string: "https://www.pointfree.co/")!)
let feedbin = Tab(url: URL(string: "https://feedbin.com/")!)
let gitHub = Tab(url: URL(string: "https://github.com/")!)
let tabGroup1 = Dictionary(uniqueKeysWithValues: [twitter, pointFree].map { ($0.id, $0) })
let tabGroup2 = Dictionary(uniqueKeysWithValues: [feedbin, gitHub].map { ($0.id, $0) })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment