Kaynağa Gözat

refactor: use if let in TagBarView to be more idiomatic

Sam Jaffe 2 hafta önce
ebeveyn
işleme
a3c5d0925b
1 değiştirilmiş dosya ile 3 ekleme ve 4 silme
  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)