Skip to content

Save development time! Respresso automatically transforms and delivers your digital assets into your projects

License

Notifications You must be signed in to change notification settings

respresso/respresso-client-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛑 Docs out-of-date notice! 🛑

This documentation is not updated anymore. All documentation of Respresso moved to https://respresso.io/docs.

✔️ Up-to-date docs for iOS is here:

Get started with Respresso

Content Link
Add Respresso to new or exiting iOS project https://respresso.io/docs/guides/ios-project-setup
Get started with Respresso CLI (auto-sync) https://respresso.io/docs/get-started-with-respresso-sync
Migrate from legacy CLI to the new CLI https://respresso.io/docs/docs/guides/migrate-from-legacy-ios-cli-and-objective-c-classes

Learn more - Docs for iOS Devs

Content Link
All about Respresso CLI setup in Xcode build https://respresso.io/docs/ios-xcode-resource-sync
Respresso CLI reference (auto-sync) https://respresso.io/docs/respresso-cli-reference
Respresso CLI config reference (auto-sync) https://respresso.io/docs/respresso-cli-config-reference
Import existing resources from iOS project Localization, Image (raster or pdf), Color
Localization format - .strings https://respresso.io/docs/localization/apple-ios-strings-format
Localization format - Swift helpers https://respresso.io/docs/localization/ios-swift-classes-format
Localization format - Objective-C helpers https://respresso.io/docs/localization/ios-objective-c-classes-format
Localization variables in Respresso https://respresso.io/docs/localization/variables
Localization variable formatting https://respresso.io/docs/localization/variable-formatting
Localization variable placeholders https://respresso.io/docs/localization/custom-variable-placeholders

Seriously, 🛑 stop 🛑 here and go to the new docs!


Respresso iOS client Tweet

Respresso is a centralized resource manager for shared Android, iOS and Web frontend projects. It allows you to simply import the latest assets into your workspace. You may store several versions of the same resource in the cloud and pick the ones you need to import. Respresso currently supports six types of resources:

  • Images
  • App icons
  • Localization
  • Fonts
  • Colors
  • Raw

Table of contents

Installation

Download the latest release

Usage

Using Respresso should be intuitive to anyone who has used Cocoapods before. Configurations are stored in the respressofile, while your current assets’ metadata are stored in respressofile.lock. Navigate to your project folder in Terminal, and type

$ respresso init

to initialize a new Respressofile.

host 'https://app.respresso.io'

project_token 'YOUR-PROJECT-TOKEN'

resource 'localization',	'1.0+'
resource 'image',		'1.0+'
resource 'font',		'1.0+'
resource 'color',		'1.0+'
resource 'appIcon',		'1.0+'
resource 'raw',			'1.0+'

Respressofile with custom host requesting four ot ouf five resource categories

⚠️ Before performing the next step, be sure to close your Xcode project.

Configure your Respressofile as explained by the next section, then type

$ respresso update

to import all requested resources into your project.

Breakdown of the respressofile

  • Include the project token received during initialization of your project in the Respresso web interface. This is done in the same manner as the host with the keyword ‘project_token’ and your token inside single quotation marks
  • Specify the required resources in the next line using the following format: resource ‘[resource_name]’, ‘[version_number]’

The currently accepted resource names are:

  • image
  • appIcon
  • color
  • localization
  • font
  • raw

Accepted version formats are:

  • [major].[minor].[patch] eg. 1.2.0
  • [major].[minor].[patch]+ eg. 1.2.0+ (not available in strict mode)
  • [major].[minor]+ eg. 1.2+ (not available in strict mode)

Optional arguments

host

Specify the host of your assets in the first line by writing ‘host’ and your URL in single quotation marks separated by a space. By omitting this argument Respresso will use its default host URL for syncing.

Available Commands

Open terminal and navigate to your project folder. Use any of the commands below by typing

$ respresso [command]
Init

Initializes a new Respressofile with an empty project token and a resource line commented out.

Install

Executes a Clean and an Update command sequentially.

Update

Downloads resources specified in your Respressofile from the server. Your current assets described in your Respressofile.lock are checked against the server’s state. If ran for the first time, a new project with your assets and a new workspace containing both projects are created.

Clean

Removes your lock file and all assets associated with Respresso.

Options

strict-mode

Enabling strict mode will guarantee you get the same results each time you sync your assets. If set to true, you may only specify exact version numbers in your Respressofile. This option is set to false by default. Usage example:

$ respresso update -strict-mode

Live localization

Real-time preview how the translations will look like in your mobile app or web. No need to wait for the next deployment.

How to setup

  1. Import 'RespressoLive' framework. It's automatically added to your project.
  2. Enable the live mode.
import RespressoLive

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
       
        RespressoLocalizationLiveEdit.shared.liveLocalizationEnabled = true
        
        return true
    }
}
  1. Use 'RespressoStrings' for localization
  2. Observe for 'RespressoDidUpdateLocalization' notification.
import Respresso

class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.updateTexts()
        
        NotificationCenter.default.addObserver(forName: NSNotification.Name.RespressoDidUpdateLocalization, object: nil, queue: nil) { [weak self] (notification) in
            self?.updateTexts()
        }
    }
    
    func updateTexts() {
        label.text = RespressoStrings.hello
    }
}

How to use it

  1. Check above instructions
  2. Go to respresso(https://app.respresso.io) sign in and choose a project
  3. Select localization in the left panel and click the same version that you synced into your project
  4. Get your phone and shake it
  5. Switch on 'Localization / Connection' in the popup window

Now your modifications are going to appearance when you click the 'Save' button on the web

  1. For using Live Edit Module* shake your phone again and switch on 'Localization / Live Editor' in the popup window
  2. On web click on the 'Live Editor' button on the top right area
  3. Scan the QR Code with your phone which visible in your web browser's top right section

Let see what happened after 7th option. You activated a visible items filter and your list have less elements than before and don't have to use Save button to get updated texts. Be careful, this modification stored just in your phone's memory and you can lose it. Use the Save button to store your modifications.

* Live Edit Module: shows real-time preview how the translations will look like in your mobile app. Check the translations’ accuracy, length and the UI experience in real-time.