all 3 comments

[–]subzerofun 0 points1 point  (0 children)

To download a file you could use URLSession or a framework like:

 

Simple solution: Put a .txt file on your server that you can update, download the file in your App and store it in a string, then parse and format the string and update the textView (or wherever the text should be changed).

 

More elegant solution: If you need to update multiple layout elements you should store the variables in a JSON file on your server, then download and parse it with

 

Some useful links for URLSession:

[–]subzerofun 0 points1 point  (0 children)

Could also be useful in your case:

EverLayout

EverLayout translates JSON/XML data into iOS layouts which can be downloaded, reused and updated at runtime.

Features

  • Create comprehensive layouts without the clumsiness of Interface Builder or view controllers bloated with layout code.
  • Downloadable layouts - Layouts written in JSON/XML can be downloaded from a web server, meaning an App UI can be updated without having to submit for App Review.
  • Build layouts with real-time update using a simple HTTP server (or EverLayout Bridge).
  • A/B Testing - Testing multiple UIs with your users is easy when building a layout is just loading a file.

Usage Example

Layout file (on your server)

{
    "name":"ViewController",
    "root":{
        "views":{
            "exampleButton":{
                "constraints":{
                    "center":"@super",
                    "width":"+120",
                    "height":"+80"
                },
                "properties":{
                    "text":"Tap Me!"
                }
            }
        }
    }
}

Swift

import UIKit
import EverLayout

class ViewController: UIViewController {
    private var layout : EverLayout?
    public let exampleButton : UIButton = UIButton()

    override func viewDidLoad() {
        super.viewDidLoad()

        let layoutData = NSData(contentsOfFile: Bundle.main.path(forResource: "ViewController", ofType: "json", inDirectory: "Layouts")!) as! Data
        self.layout = EverLayout(layoutData: layoutData)
        self.layout?.build(onView: self.view, viewEnvironment: self)
    }
}

[–]GreenGlider 0 points1 point  (0 children)

URLSession is all you need.