Skip to content

Commit

Permalink
Start with why
Browse files Browse the repository at this point in the history
  • Loading branch information
mac-cain13 committed Nov 6, 2015
1 parent 4235beb commit 734e371
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Documentation/QandA.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Questions and Answers

## What are the requirements to run R.swift?
## Why was R.swift created?

Recommended is the latest stable version of OS X, Xcode with the app deployed iOS 7 or higher. But OS X 10.10 with Xcode 6.1 or higher should work. R.swift should also always be runned within the Xcode build process since it needs some of the environment variables. Otherwise it could throw errors at you.
Swift is a beautiful language and one of it's main advantages is that more and more is typed. This catches a lot of errors at compile time. It feels very strange to refer to resources with strings that will always compile and then fail at runtime. It makes refactoring hard and it's to easy to create bugs like missing images etc.

In Android there is a generated R class that kind of solves this problem. That was why I decided to make something like it for us Swift developers and called the project R.swift. It was well received by colleagues, friends and Github stargazers, so here we are now.

## Why should I choose R.swift over alternative X or Y?

Expand All @@ -11,15 +13,13 @@ There are many nice R.swift alternatives like [Shark](https://github.com/kaanded
- R.swift supports a lot of different assets
- R.swift stays very close to the vanilla Apple API's, it's a minimal code change with maximum impact

## What are the requirements to run R.swift?

Recommended is the latest stable version of OS X, Xcode with the app targeting iOS 8 or higher. But OS X 10.10 with Xcode 7 while targeting iOS 7 or higher should work. R.swift should also always be runned within the Xcode build process since it needs some of the environment variables. Otherwise it could throw errors at you.

## How does R.swift work?

Well you add R.swift as a Build phase to your target, basically this means that:
During installation you add R.swift as a Build phase to your target, basically this means that:
- Every time you build R.swift will be runned
- It takes a look at your Xcode project file and inspects all resources linked with the target currently build
- It generates a `R.generated.swift` file that contains a struct with types references to all resources

## Why was R.swift created?

Swift is a beautiful language and one of it's main advantages is that more and more is typed. This catches a lot of errors at compile time. It feels very strange to refer to resources with strings that will always compile and then fail at runtime. It makes refactoring hard and it's to easy to create bugs like missing images etc.

In Android there is a generated R class that kind of solves this problem. That was why I decided to make something like it for us Swift developers and called the project R.swift. It was well received by colleagues, friends and Github stargazers, so here we are now.

0 comments on commit 734e371

Please sign in to comment.