如何从Swift 4中的异构数组中转换?

时间:2017-12-29 06:54:52

标签: swift4

let data = ["1", "2", 3, 4, 5];

var m: Int = data[3] as! Int;
  

错误:MyPlayground.playground:238:12:错误:异构集合文字只能推断为'[Any]';如果这是故意的,请添加显式类型注释      let data = [“1”,“2”,3,4,5];
                  ^ ~~~~~~~~~~~~~~~~~~ [任意]

1 个答案:

答案 0 :(得分:0)

您是否尝试过做错误提示的内容?

getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.arrowleft);