This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum PromiseError: Error { | |
case invaild | |
} | |
public struct AsyncExecutor { | |
public static let main = AsyncExecutor() | |
public static let background = AsyncExecutor(qos: .default) | |
private let queue: DispatchQueue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol X { | |
func hello() | |
} | |
extension X { | |
func hello() { | |
print("Hello") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UnivalCountSolution { | |
private var count = 0 | |
private var testCount = 0 | |
func soultion(_ root: TreeNode?) -> Int { | |
guard let root = root else { | |
return 0 | |
} | |
isUnivalSubtree(root) | |
return count | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Solution(_ nums1:[Int], _ nums2: [Int]) -> Int? { | |
let set: Set<Int> = Set(nums1) | |
var result: Int? | |
for element in nums2 { | |
if set.contains(element) { | |
if let currentMin = result { | |
result = min(element, currentMin) | |
continue | |
} | |
result = element |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (viod)loadSongInfo:(LocalSongInfo *)inSongInfo | |
{ | |
// load image | |
if (inSongInfo.source == ... ) { | |
self.coverImage.image = [[MediaItem itemWithSongID:...].artwork imageWith...]; | |
} | |
else if (inSongInfo.source == ... ) { | |
SongMetadata *metadata = ... | |
[metadata getImagWithCallback:...] | |
} |