Getting the currently running target name

How can I reliably get the currently running target name in Swift 4 ?

 

My solution so far is the following:

 

        let bundle = Bundle.main
        let executablePath = bundle.executablePath
        let splitArray = executablePath?.split(separator: "/")
        let targetName = splitArray?.last?.description

 

Is there a better way ?

Powered by WPeMatico

About

You may also like...

Comments are closed.