Skip to content

Commit

Permalink
Merge branch 'master' into lammertw-watchos
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlokhorst committed Jun 10, 2019
2 parents 490b847 + e029b16 commit 6c08f94
Show file tree
Hide file tree
Showing 46 changed files with 526 additions and 271 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ rswift.xcarchive
rswift.xcodeproj
.build
build
DerivedData
43 changes: 43 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
## 5.0.3

- Fix for stand alone image files (Thanks @CraigsOverItAll)

## 5.0.2

- Fix issues with legacy build system by adding option to disable input checks

## 5.0.1

- Fixes for relative paths

## 5.0.0

- Compatible with Xcode 10 / iOS 12 SDK, this release is not compatible with older versions use R.swift 4 if you still need that compatibility
- Removed CLR file support, use color resources instead
- Easier nib loading with new method
- Ignore file supports explicit include (by @renrawnalon)
- Validation for named colors
- Empty structs are not generated anymore (by @soberman)
- Update XcodeEdit
- Performance tweaks by @bclymer
- Fix for validate images by @cooler333
- Nib parsing fixes for Xcode 10 from @rafaelnobrepd

## 5.0.0.rc.2

- Improve R.swift 5 migration errors

## 5.0.0.rc.1

- Xcode 10 compatibility fixes

## 5.0.0.alpha.3

- Update XcodeEdit
- Performance tweaks by @bclymer
- Fix for validate images by @cooler333

## 5.0.0.alpha.2

- Nib parsing fixes for Xcode 10 from @rafaelnobrepd

## 5.0.0.alpha.1

- Removed CLR file support, use color resources instead
Expand Down
Binary file added Documentation/Images/BuildPhaseExample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions Documentation/Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

Pointers for migration between major versions.

## Upgrading to 5.0

- Make sure you use Xcode 10 since we've adjusted to the SDK changes
- At the moment we are compatible with both Swift 4 and 4.2, this is more an accident then a feature, beware that we might drop Swift 4 support anytime.

If you are using the "New Build System":
- In the Build Phase you must perform some changes, [see an example screenshot](Images/BuildPhaseExample.png):
* Change the script to give the explicit output file, for example: `"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT/[YOUR_PATH]/R.generated.swift"`
* Add `$TEMP_DIR/rswift-lastrun` to the "Input Files" of the Build Phase
* Add `$SRCROOT/[YOUR_PATH]/R.generated.swift` to the "Output Files" of the Build Phase

If you are using the "Legacy Build System":
- Add the flag `--disable-input-output-files-validation` and *do not* add input/output files to the Build Phase, [See an example screenshot](Images/BuildPhaseExample_LegacyBuildSystem.png).

## Upgrading to 4.0

- Make sure you use Swift 4 / Xcode 9 since we've adjusted to the syntax and SDK changes.
Expand Down
2 changes: 1 addition & 1 deletion Documentation/QandA.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ There are many nice R.swift alternatives like [SwiftGen](https://github.com/AliS

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

R.swift works with iOS 8 and tvOS 9 and higher, your development machine should be on OS X 10.11 with Xcode 7 or higher.
R.swift works with Xcode 10 for apps targetting iOS 8 and tvOS 9 and higher.

## How to use methods with a `Void` argument?

Expand Down
2 changes: 1 addition & 1 deletion License
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014-2017 Mathijs Kadijk
Copyright (c) 2014-2019 Mathijs Kadijk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"repositoryURL": "https://github.com/kylef/Spectre.git",
"state": {
"branch": null,
"revision": "e34d5687e1e9d865e3527dd58bc2f7464ef6d936",
"version": "0.8.0"
"revision": "f14ff47f45642aa5703900980b014c2e9394b6e5",
"version": "0.9.0"
}
},
{
"package": "XcodeEdit",
"repositoryURL": "https://github.com/tomlokhorst/XcodeEdit",
"state": {
"branch": null,
"revision": "327900c5253a695120469d58374ee157e498e1c2",
"version": "2.3.0"
"revision": "1af368143ca4843136df5b3945f2cc3c49b980e0",
"version": "2.7.1"
}
}
]
Expand Down
10 changes: 6 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// swift-tools-version:4.0
// swift-tools-version:5.0
import PackageDescription

let package = Package(
name: "rswift",
platforms: [
.macOS(.v10_11)
],
dependencies: [
.package(url: "https://github.com/kylef/Commander.git", from: "0.8.0"),
.package(url: "https://github.com/tomlokhorst/XcodeEdit", from: "2.3.0")
.package(url: "https://github.com/tomlokhorst/XcodeEdit", from: "2.7.0")
],
targets: [
.target(
Expand All @@ -17,6 +20,5 @@ let package = Package(
dependencies: ["Commander", "XcodeEdit"]
),
.testTarget(name: "RswiftCoreTests", dependencies: ["RswiftCore"]),
],
swiftLanguageVersions: [4]
]
)
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project 'ResourceApp/ResourceApp'
abstract_target 'Shared' do
inhibit_all_warnings!

pod 'R.swift.Library', :git => 'git@github.com:mac-cain13/R.swift.Library.git' # for CI builds
pod 'R.swift.Library', :git => 'https://github.com/mac-cain13/R.swift.Library.git' # for CI builds
# pod 'R.swift.Library', :path => '../R.swift.Library' # for development

target 'ResourceApp' do
Expand Down
8 changes: 4 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- R.swift.Library (5.0.0.alpha.1)
- R.swift.Library (5.0.1)
- SWRevealViewController (2.3.0)

DEPENDENCIES:
Expand All @@ -15,9 +15,9 @@ EXTERNAL SOURCES:
:path: "../R.swift.Library"

SPEC CHECKSUMS:
R.swift.Library: 359acaa49759c1416931843177e3cf9ce02d3131
R.swift.Library: 08f4e67e3cf6ce0f1802d6a477933ddc6c2cf439
SWRevealViewController: 6d3fd97f70112fd7cef9de14df4260eacce4c63a

PODFILE CHECKSUM: 090ba72e7d5bd4645f42c0dfe54ce021970b6dc6
PODFILE CHECKSUM: c435af636d6b8e54454355f7e6438f493f341002

COCOAPODS: 1.5.3
COCOAPODS: 1.7.1
4 changes: 2 additions & 2 deletions R.swift.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |spec|

spec.name = "R.swift"
spec.version = "5.0.0.alpha.1"
spec.version = "5.0.3"
spec.license = "MIT"

spec.summary = "Get strong typed, autocompleted resources like images, fonts and segues in Swift projects"
Expand All @@ -27,7 +27,7 @@ Pod::Spec.new do |spec|
spec.tvos.deployment_target = '9.0'
spec.watchos.deployment_target = '2.2'

spec.dependency "R.swift.Library", "~> 5.0.0.alpha.1"
spec.dependency "R.swift.Library", "~> 5.0.1"

spec.preserve_paths = "rswift"

Expand Down
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Currently you type:
```swift
let icon = UIImage(named: "settings-icon")
let font = UIFont(name: "San Francisco", size: 42)
let color = UIColor(named: "indictator highlight")
let color = UIColor(named: "indicator highlight")
let viewController = CustomViewController(nibName: "CustomView", bundle: nil)
let string = String(format: NSLocalizedString("welcome.withName", comment: ""), locale: NSLocale.current, "Arthur Dent")
```
Expand Down Expand Up @@ -88,22 +88,18 @@ Runtime validation with [`R.validate()`](Documentation/Examples.md#runtime-valid

_Note on Carthage: R.swift is a tool used in a build step, it is not a dynamic library. Therefore [it is not possible](https://github.com/mac-cain13/R.swift/issues/42) to install it with Carthage._

> ### ⚠️ Change between R.swift 3 and R.swift 4
> Be aware:
> For R.swift 3.x and below, the `rswift` executable should be called with only one argument: `rswift $SRCROOT`
> For R.swift 4, the `rswift` executable should be called with two arguments: `rswift generate $SRCROOT`
### CocoaPods (recommended)

_There is also a [short video](https://vimeo.com/122888912) of this instruction._

1. Add `pod 'R.swift'` to your [Podfile](http://cocoapods.org/#get_started) and run `pod install`
2. In Xcode: Click on your project in the file list, choose your target under `TARGETS`, click the `Build Phases` tab and add a `New Run Script Phase` by clicking the little plus icon in the top left
3. Drag the new `Run Script` phase **above** the `Compile Sources` phase and **below** `Check Pods Manifest.lock`, expand it and paste the following script:
```
"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT"
"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT/R.generated.swift"
```
4. Build your project, in Finder you will now see a `R.generated.swift` in the `$SRCROOT`-folder, drag the `R.generated.swift` files into your project and **uncheck** `Copy items if needed`
4. Add `$TEMP_DIR/rswift-lastrun` to the "Input Files" and `$SRCROOT/R.generated.swift` to the "Output Files" of the Build Phase
5. Build your project, in Finder you will now see a `R.generated.swift` in the `$SRCROOT`-folder, drag the `R.generated.swift` files into your project and **uncheck** `Copy items if needed`

_Screenshot of the Build Phase can be found [here](Documentation/Images/BuildPhaseExample.png)_

_Tip:_ Add the `*.generated.swift` pattern to your `.gitignore` file to prevent unnecessary conflicts.

Expand All @@ -114,9 +110,12 @@ _Tip:_ Add the `*.generated.swift` pattern to your `.gitignore` file to prevent
2. In Xcode: Click on your project in the file list, choose your target under `TARGETS`, click the `Build Phases` tab and add a `New Run Script Phase` by clicking the little plus icon in the top left
3. Drag the new `Run Script` phase **above** the `Compile Sources` phase, expand it and paste the following script:
```
"$SRCROOT/rswift" generate "$SRCROOT"
"$SRCROOT/rswift" generate "$SRCROOT/R.generated.swift"
```
4. Build your project, in Finder you will now see a `R.generated.swift` in the `$SRCROOT`-folder, drag the `R.generated.swift` files into your project and **uncheck** `Copy items if needed`
4. Add `$TEMP_DIR/rswift-lastrun` to the "Input Files" and `$SRCROOT/R.generated.swift` to the "Output Files" of the Build Phase
5. Build your project, in Finder you will now see a `R.generated.swift` in the `$SRCROOT`-folder, drag the `R.generated.swift` files into your project and **uncheck** `Copy items if needed`

_Screenshot of the Build Phase can be found [here](Documentation/Images/BuildPhaseExample.png)_

_Tip:_ Add the `*.generated.swift` pattern to your `.gitignore` file to prevent unnecessary conflicts.

Expand All @@ -125,7 +124,7 @@ _Tip:_ Add the `*.generated.swift` pattern to your `.gitignore` file to prevent
R.swift is built using [Swift Package Manager (SPM)](https://github.com/apple/swift-package-manager).

1. Check out the code
2. Run `swift build -c release -Xswiftc -static-stdlib` from the root directory
2. Run `swift build -c release` from the root directory
3. Follow the manual installation steps with the binary you now have

For developing on R.swift in Xcode, run `swift package generate-xcodeproj --xcconfig-overrides RswiftConfig.xcconfig`.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "1.000",
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000"
}
}
}
]
}
33 changes: 29 additions & 4 deletions ResourceApp/ResourceApp-tvOS/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="14490.70" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="appleTV" orientation="landscape">
<adaptation id="light"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<deployment version="4352" identifier="tvOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -15,11 +21,30 @@
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="calibratedWhite"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2Fg-tm-zcG">
<rect key="frame" x="939" y="519" width="42" height="42"/>
<color key="backgroundColor" name="BrightWhite"/>
<constraints>
<constraint firstAttribute="width" constant="42" id="1Rz-Hd-6JQ"/>
<constraint firstAttribute="height" constant="42" id="iWV-bG-a6B"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="2Fg-tm-zcG" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="HPj-Jx-jJz"/>
<constraint firstItem="2Fg-tm-zcG" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="v8J-BR-Ibj"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
<resources>
<namedColor name="BrightWhite">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
Loading

0 comments on commit 6c08f94

Please sign in to comment.