# Swift 已有 array 转 NSMutableArray

**URL:** <https://www.shiqidu.com/t/topic/647>\
**Category:** 开发调优\
**Tags:** Swift\
**Created:** [2019 年9 月 22 日 16:07 UTC](https://www.shiqidu.com/t/topic/647 "2019-09-22T16:07:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

作者： ![Eureka](https://www.shiqidu.com/user_avatar/www.shiqidu.com/eureka/32/5_2.png) [@Eureka](https://www.shiqidu.com/u/Eureka)\
发布日期： [2019 年9 月 22 日 16:07 UTC](https://www.shiqidu.com/t/topic/647/1 "2019-09-22T16:07:54Z")

</div>

Swift 将 现有的 array 转成 NSMutableArray 的方法

```swift
// array 转 NSMutableArray
func array2NSMutableArray(_ array: [Any]) -> NSMutableArray {
    let NSMutableArray: NSMutableArray = []
    for item in array {
        NSMutableArray.add(item)
    }
    return NSMutableArray
}

```
