簡體   English   中英

Swift2在字典中檢查數組

[英]Swift2 check array in dictionary

我正在嘗試在一行中創建案例,但是我找不到該怎么做

我需要在一行中編寫該代碼

     if let holdings = i["holdings"] as Array where !holdings.isEmpty {

有任何想法嗎?

AnyObject,因為您未指定數組內部的內容。

if let holdings = i["key"] as? [AnyObject] where !holdings.isEmpty

要么

if let holdings = i["key"] as? Array<AnyObject> where !holdings.isEmpty

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM