✅ [Accepted] Solution for Swift
swift\nclass Solution {\n    func searchBST(_ root: TreeNode?, _ val: Int) -> TreeNode? {\n        guard let root = root else { return nil }\n        return val
```swift\nclass Solution {\n    func searchBST(_ root: TreeNode?, _ val: Int) -> TreeNode? {\n        guard let root = root else { return nil }\n        return val == root.val ? root : searchBST(val < root.val ? root.left : root.right, val)\n    }\n}\n```\n\n<hr>\n\n<details>\n<summary><img src="https://git.io/JDblm" height="24"> <b>TEST CASES</b></summary>\n\n<pre>\nResult: Executed 2 tests, with 0 failures (0 unexpected) in 0.059 (0.061) seconds\n</pre>\n\n```swift\nimport XCTest\n\nclass Tests: XCTestCase {\n    \n    private let solution = Solution()\n    \n    func test1() {\n        let tree = solution.searchBST(TreeNode([4,2,7,1,3]), 2)\n        XCTAssertEqual(tree?.val, TreeNode([2,1,3])?.val)\n    }\n    \n    func test2() {\n        let tree = solution.searchBST(TreeNode([4,2,7,1,3]), 5)\n        XCTAssertEqual(tree?.val, TreeNode([])?.val)\n    }\n}\n```\n\n</details>
['Swift']