reading data from info.plist

Discussion in 'iOS Programming' started by erdinc27, Feb 26, 2018.

  1. erdinc27 macrumors regular

    Jul 20, 2011
    hey guys. I have two Targets(Test and Dev) in my project. They have different base url and endpoint names that are hold in info-Test.plist and info-Dev.plist. What I want to do is I want to read that base url and enpoints in a class and use them as global variables. I have a Configuration.swift file and when I try to read the plist items like that
    if let baseURL = Bundle.main.path(forResource: "info", ofType: "plist") {
    then i get that error
    Where it would be better option to read that values and hold them as globals?
  2. VolceOntra macrumors 6502


    Apr 25, 2007
    You can use a function (perhaps static) that returns your baseurl
  3. lisamona macrumors newbie

    Apr 23, 2018

Share This Page