# How to turn a static var string into array

**URL:** <https://forums.kodeco.com/t/how-to-turn-a-static-var-string-into-array/33981>\
**Category:** Swift\
**Created:** [September 2, 2017, 8:50pm UTC](https://forums.kodeco.com/t/how-to-turn-a-static-var-string-into-array/33981 "2017-09-02T20:50:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timswift](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/timswift/32/110937_2.png) [@timswift](https://forums.kodeco.com/u/timswift)\
**Post date:** [September 2, 2017, 8:50pm UTC](https://forums.kodeco.com/t/how-to-turn-a-static-var-string-into-array/33981/1 "2017-09-02T20:50:20Z")

</div>

My code below is a string inside of a struct. How can do the exact same thing expect replace the string with a array.

```
         struct gv{
        static var mystruct = [String]();
     
    }

```

---

<div class="post-metadata">

**Author:** ![nikita\_gaydukov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/nikita_gaydukov/32/77683_2.png) [@nikita\_gaydukov](https://forums.kodeco.com/u/nikita_gaydukov)\
**Post date:** [September 3, 2017, 4:12pm UTC](https://forums.kodeco.com/t/how-to-turn-a-static-var-string-into-array/33981/2 "2017-09-03T16:12:56Z")

</div>

Hi @timswift

The code you provided does exactly what you are looking for, it’s an array of String objects.  
Static variable of type String would look like this:

```
struct gv
{
        static var mystruct:String = "some value";
}

```

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [February 16, 2018, 12:50pm UTC](https://forums.kodeco.com/t/how-to-turn-a-static-var-string-into-array/33981/3 "2018-02-16T12:50:29Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
