Skip to content

Commit

Permalink
Updated for 0.6.13 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Jan 10, 2018
1 parent 1ba0343 commit ecc863b
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 40 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [0.6.13](https://github.com/schibsted/layout/releases/tag/0.6.13) (2018-01-10)

- Fixed spurious error when trying to use `center.x` or `center.y` inside an expression
- Fixed a bug where positioning views relative to their parent size would not work if parent was auto-sized
- Added warnings view to LayoutConsole. Warnings appear as a dimissable bar at the bottom of the screen
- Fixed intermittent issue where Layout would get stuck in a loading loop after reloading
- Added a mechanism for marking properties as deprecated

## [0.6.12](https://github.com/schibsted/layout/releases/tag/0.6.12) (2018-01-08)

- Fixed safeAreaInsets regression
Expand Down
2 changes: 1 addition & 1 deletion EditorExtension/Application/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.6.12</string>
<string>0.6.13</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion EditorExtension/Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>0.6.12</string>
<string>0.6.13</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions Layout.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Layout",
"version": "0.6.12",
"version": "0.6.13",
"license": {
"type": "MIT",
"file": "LICENSE.md"
Expand All @@ -10,7 +10,7 @@
"authors": "Nick Lockwood",
"source": {
"git": "https://github.com/schibsted/layout.git",
"tag": "0.6.12"
"tag": "0.6.13"
},
"default_subspecs": "Core",
"subspecs": [
Expand Down
2 changes: 1 addition & 1 deletion Layout/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.6.12</string>
<string>0.6.13</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
6 changes: 3 additions & 3 deletions Layout/LayoutConsole.swift
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private class LayoutWarningView: UIView, LayoutLoading {
"backgroundColor": "yellow",
"height": "auto + max(5, safeAreaInsets.bottom)",
"width": "100%",
"touchUpInside": "hide"
"touchUpInside": "hide",
],
children: [
LayoutNode(
Expand All @@ -312,11 +312,11 @@ private class LayoutWarningView: UIView, LayoutLoading {
"height": "auto",
"text": "{warning}",
]
)
),
]
)
} else {
self.layoutNode?.setState([
layoutNode?.setState([
"warning": self.warnings.last ?? "",
])
}
Expand Down
52 changes: 26 additions & 26 deletions Layout/LayoutNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1466,36 +1466,36 @@ public class LayoutNode: NSObject {

#if arch(i386) || arch(x86_64)

private lazy var deprecatedViewSymbols: [String: String] = {
return self.viewClass.deprecatedSymbols
}()

private lazy var deprecatedViewControllerSymbols: [String: String] = {
return self.viewControllerClass.map { $0.deprecatedSymbols } ?? [:]
}()

private func handleDeprecation(for symbol: String) {
let cls: AnyClass
let alternative: String
if let _alternative = deprecatedViewControllerSymbols[symbol] {
cls = _class
alternative = _alternative

} else if let _alternative = deprecatedViewSymbols[symbol] {
cls = viewClass
alternative = _alternative
} else {
return
private lazy var deprecatedViewSymbols: [String: String] = {
self.viewClass.deprecatedSymbols
}()

private lazy var deprecatedViewControllerSymbols: [String: String] = {
self.viewControllerClass.map { $0.deprecatedSymbols } ?? [:]
}()

private func handleDeprecation(for symbol: String) {
let cls: AnyClass
let alternative: String
if let _alternative = deprecatedViewControllerSymbols[symbol] {
cls = _class
alternative = _alternative

} else if let _alternative = deprecatedViewSymbols[symbol] {
cls = viewClass
alternative = _alternative
} else {
return
}
_unhandledWarnings.append(
"\(cls).\(symbol) is deprecated\(alternative.isEmpty ? "" : ". Use \(alternative) instead")"
)
bubbleUnhandledErrors()
}
_unhandledWarnings.append(
"\(cls).\(symbol) is deprecated\(alternative.isEmpty ? "" : ". Use \(alternative) instead")"
)
bubbleUnhandledErrors()
}

#else

private func handleDeprecation(for symbol: String) {}
private func handleDeprecation(for _: String) {}

#endif

Expand Down
2 changes: 1 addition & 1 deletion LayoutTool/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Foundation

/// The current LayoutTool version
let version = "0.6.12"
let version = "0.6.13"

extension String {
var inDefault: String { return "\u{001B}[39m\(self)" }
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,20 @@ You can reload your XML files at any time by pressing Cmd-R in the simulator (no

**Note:** This only works for changes you make to your layout XML files, or in your `Localizable.strings` file, not for Swift code changes in your view controller, or other resources such as images.

The live reloading feature, combined with the gracious handling of errors, means that it should be possible to do most of your interface development without needing to recompile the app.
The live reloading feature, combined with the graceful handling of errors, means that it should be possible to do most of your interface development without needing to recompile the app.


## Debugging

If the Layout framework throws an error during XML parsing, mounting, or updating, it will display the *Red Box*, which is a full-screen overlay that displays the error message along with a reload button.

Thanks to the [live reloading](#live-reloading) feature, many bugs (e.g. syntax errors or misnamed properties) can be fixed without recompiling the app. Once you have fixed the bug, pressing reload (or Cmd-R) will dismiss the error console and reload the layout XML file.
For non-critical errors (e.g. using a deprecated API) Layout will display a yellow warning bar at the bottom of the screen, which can be dismissed with a tap.

Thanks to the [live reloading](#live-reloading) feature, many bugs (e.g. syntax errors or misnamed properties) can be fixed without recompiling the app. Once you have fixed the bug, pressing reload (or Cmd-R) will dismiss any warnings or errors and reload the layout XML file.

The Red Box interface is managed by the `LayoutConsole` singleton. This exposes static methods to show and hide the console, along with an `isEnabled` property to enable or disable the console programmatically. By default, the console is enabled for debug builds and disabled for release, but if you need to override this setting at runtime you can do so.

If the `LayoutConsole` is disabled, errors will be printed to the Xcode console instead.
If the `LayoutConsole` is disabled, errors and warnings will be printed to the Xcode console instead.


## Constants
Expand Down Expand Up @@ -2384,7 +2386,7 @@ The default implementation of `LayoutLoading` will bubble errors up the responde

## Manual Integration

If you would prefer not to use either the `LayoutLoading` protocol, you can mount a `LayoutNode` into a view or view controller manually by using the `mount(in:)` method:
If you would prefer not to use the `LayoutLoading` protocol, you can mount a `LayoutNode` into a view or view controller manually by using the `mount(in:)` method:

```swift
class MyViewController: UIViewController {
Expand Down
2 changes: 1 addition & 1 deletion format.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
!# /usr/bin/env bash

if [[ -z "${TRAVIS}" ]]; then
swiftformat . --exclude "Pods,Layout/Vendor,LayoutTool/Symbols.swift" --header "// Copyright © 2017 Schibsted. All rights reserved." --binarygrouping 8,8 --decimalgrouping ignore --disable sortedImports
swiftformat . --exclude "Pods,Layout/Vendor,LayoutTool/Symbols.swift" --header "// Copyright © 2017 Schibsted. All rights reserved." --binarygrouping 8,8 --decimalgrouping ignore --disable sortedImports --cache ignore
LayoutTool/LayoutTool format .
fi

0 comments on commit ecc863b

Please sign in to comment.