Procházet zdrojové kódy

refactor: use if let in TagBarView to be more idiomatic

Sam Jaffe před 2 týdny
rodič
revize
a3c5d0925b
1 změnil soubory, kde provedl 3 přidání a 4 odebrání
  1. 3 4
      Todos/View/TagBarView.swift

+ 3 - 4
Todos/View/TagBarView.swift

@@ -19,10 +19,9 @@ struct TagBarView: View {
   var body: some View {
     HStack {
       ForEach($task.tags) { tag in
-        let url = allHints.filter({ $0.matches(tag.wrappedValue) })
-          .first?.url(tag.wrappedValue)
-        if url != nil {
-          Link(destination: url!) {
+        if let url = allHints.filter({ $0.matches(tag.wrappedValue) })
+          .first?.url(tag.wrappedValue) {
+          Link(destination: url) {
             Label("", systemImage: "link")
           }
           .padding(.leading, -8)