Q:

Structure passing variables in another class

Basically, I am trying to build a music player app in order to learn iOS platform and Swift 3, but I am currently stuck on a simple step. I am trying to create an array of type song and append to that array the song names, after that song artist, etc. 
The function also needs to be modified. I was using it before with a array of names, but after that I decided to create this struct.
import Foundation

struct Song {

    var _songTitle:String?

    var _songArtist:String?

    var _songDuration:Double?

    var _songCover:String?

}

import AVFoundation

class AudioManager: NSObject, AVAudioPlayerDelegate  {
static let sharedInstance = AudioManager()

var currentSong = 0

var currentTime = 0

var player: AVAudioPlayer = AVAudioPlayer()

private override init() {}

private var songs: [Song] = []

func play()
{

        player.play()
}

func stop() {
    if player.isPlaying{
     player.stop()
    }

}

func playThis()
{

    do
    {
        guard let audioPath = Bundle.main.path(forResource: songs._songTitle?[currentSong], ofType: ".mp3")
            else {
                return

        }
        try player = AVAudioPlayer(contentsOf: NSURL(fileURLWithPath: audioPath) as URL)

    }
    catch
    {
        print ("ERROR")

    }

}

    func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool)
{

    if flag {
        currentSong += 1
    }

    if ((currentSong + 1) == songs.count) {
        currentSong = 0
    }

}

func skipForward() {
    var timeToSkip: TimeInterval = player.currentTime
    timeToSkip += 5.0
    player.currentTime = timeToSkip
}

func skipBack() {
    var timeToSkip: TimeInterval = player.currentTime
    timeToSkip -= 5.0
    player.currentTime = timeToSkip
}

func gettingSongNames()
{
    let folderURL = URL(fileURLWithPath:Bundle.main.resourcePath!)

    do
    {
        let songPath = try FileManager.default.contentsOfDirectory(at: folderURL, includingPropertiesForKeys: nil, options: .skipsHiddenFiles)

        //loop through the found urls
        for song in songPath
        {
            var mySong = song.absoluteString

            if mySong.contains(".mp3")
            {
                let findString = mySong.components(separatedBy: "/")
                mySong = findString[findString.count-1]
                mySong = mySong.replacingOccurrences(of: "%20", with: " ")
                mySong = mySong.replacingOccurrences(of: ".mp3", with: "")
                song._songTitle.append(mySong)

            }

        }

    }
    catch
    {
        print ("ERROR")
    }
}

}

A:

You are combining struct member access and array indexing in the wrong order. For example you have an array song of type [Song], that is an array of songs, and to access a particular title you write:
songs._songTitle?[currentSong]

Which says "songs has an array-valued property _songTitle, access its currentSong element" - this is backwards. You need to access the array element first, which returns a Song, and then the property:
songs[currentSong]._songTitle

You also appear to wish to create a new song only specifying a title. To do this you shoul add an init method to Song along the lines of:
init(withTitle: String) { ... }

Which sets the title of the new song to the supplied value and the other properties to nil. (If you don't know about init methods look in Apple's Swift book.)
Once you have this initialiser adding a new song becomes something like:
songs.append( Song(withTitle:mySong) )

HTH

