         }
     }
 }
+
+func tryToResult<T>(block: () throws -> T) -> Result<T, Error> {
+    do {
+        return .success(try block())
+    } catch {
+        return .failure(error)
+    }
+}

    }

    @objc func reachabilityChanged(_ notification: Notification) {
        guard let reachability = notification.object as? Reachability else {
            assert(false, "this should never happen!")
            S1LogError("this should never happen!")
            return
        }

        if reachability.isReachableViaWiFi() {
            S1LogDebug("[Reachability] WIFI: display picture")
        } else {
            S1LogDebug("[Reachability] WWAN: display placeholder")
        }
    }
}

// MARK: Setup

struct ForumInfo: Codable, Equatable {
    let id: Int

        let defaultsPlistString = String(data: defaultsPlistData, encoding: .utf8)!
        S1LogVerbose("Dump user defaults: \(defaultsPlistString)")

        _ = NotificationCenter.default.publisher(for: .reachabilityChanged)
            .sink(receiveValue: { notification in
                guard let reachability = notification.object as? Reachability else {
                    assertionFailure()
                    return
                }

                if reachability.isReachableViaWiFi() {
                    S1LogDebug("[Reachability] WIFI: display picture")
                } else {
                    S1LogDebug("[Reachability] WWAN: display placeholder")
                }
            })

        #endif

