Skip to content

Instantly share code, notes, and snippets.

@jasdev
Created February 20, 2022 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasdev/6711e2d8651c5be1603d87a2086d56fb to your computer and use it in GitHub Desktop.
Save jasdev/6711e2d8651c5be1603d87a2086d56fb to your computer and use it in GitHub Desktop.
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