Skip to content

Commit

Permalink
Merge branch 'release-0.5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
wangshengjia committed May 2, 2016
2 parents b9042f8 + 3a98d59 commit e3a0e6c
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 32 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@

-----

## [1.0.0 - LeeGo, let's do this !](https://github.com/wangshengjia/LeeGo/releases/tag/1.0.0) (2016-05-01)

First public release. :tada::tada:
8 changes: 4 additions & 4 deletions Demo/LeeGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
358507941C622B6C006D02EF /* TheSansOsF-SemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 358507891C622B6A006D02EF /* TheSansOsF-SemiBold.otf */; };
358507951C622B6C006D02EF /* TheSansOsF-SemiLight.otf in Resources */ = {isa = PBXBuildFile; fileRef = 3585078A1C622B6A006D02EF /* TheSansOsF-SemiLight.otf */; };
35B44E361C84E4E60049553F /* Tweet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35B44E351C84E4E60049553F /* Tweet.swift */; };
35BD85331CA89598005B3E53 /* component.json in Resources */ = {isa = PBXBuildFile; fileRef = 35BD85321CA89598005B3E53 /* component.json */; };
35BD85331CA89598005B3E53 /* standard_brick.json in Resources */ = {isa = PBXBuildFile; fileRef = 35BD85321CA89598005B3E53 /* standard_brick.json */; };
35D7F44D1CC4E5EB008D1AEB /* SamplesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35D7F44B1CC4E5EB008D1AEB /* SamplesViewController.swift */; };
35D7F44E1CC4E5EB008D1AEB /* SampleItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35D7F44C1CC4E5EB008D1AEB /* SampleItem.swift */; };
35F5204A1C7C7BEF0089FF41 /* DemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35F520491C7C7BEF0089FF41 /* DemoTests.swift */; };
Expand Down Expand Up @@ -76,7 +76,7 @@
359374D51CD5D53A00062912 /* Layout.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = Layout.md; sourceTree = "<group>"; };
359374E21CD5D85C00062912 /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = ../CHANGELOG.md; sourceTree = "<group>"; };
35B44E351C84E4E60049553F /* Tweet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tweet.swift; sourceTree = "<group>"; };
35BD85321CA89598005B3E53 /* component.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = component.json; sourceTree = "<group>"; };
35BD85321CA89598005B3E53 /* standard_brick.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = standard_brick.json; sourceTree = "<group>"; };
35D7F44B1CC4E5EB008D1AEB /* SamplesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SamplesViewController.swift; sourceTree = "<group>"; };
35D7F44C1CC4E5EB008D1AEB /* SampleItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SampleItem.swift; sourceTree = "<group>"; };
35F51FBA1C7C61A40089FF41 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
Expand Down Expand Up @@ -135,7 +135,7 @@
350E0DEF1C81F16D00DB78FC /* LeMondeNewsFeedViewController.swift */,
35FFB6A71C7A8C070035EC52 /* Element.swift */,
350637461C4C1AAC00B5E547 /* ElementViewModel.swift */,
35BD85321CA89598005B3E53 /* component.json */,
35BD85321CA89598005B3E53 /* standard_brick.json */,
);
name = LeMonde;
sourceTree = "<group>";
Expand Down Expand Up @@ -386,7 +386,7 @@
3585078B1C622B6C006D02EF /* FetteEngschrift.otf in Resources */,
358507931C622B6C006D02EF /* TheSansOsF-Plain.otf in Resources */,
3585078E1C622B6C006D02EF /* TheAntiquaB-W5PlainItalic.otf in Resources */,
35BD85331CA89598005B3E53 /* component.json in Resources */,
35BD85331CA89598005B3E53 /* standard_brick.json in Resources */,
350E0DF61C84DD3700DB78FC /* twitter_sample.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
30 changes: 24 additions & 6 deletions Demo/LeeGo/DetailsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@ class DetailsViewController: UIViewController {
super.viewDidLoad()

setup()

// This requires XcodeInjection to work
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(setup), name: "INJECTION_BUNDLE_NOTIFICATION", object: nil)
}
}

extension DetailsViewController {

func setup() {
private func setup() {
let title = "title".build(UILabel).style([.numberOfLines(0), .text("Lorem Ipsum is simply dummy text of the printing industry")])
let description = "description".build(UILabel).style([.textColor(UIColor.lightGrayColor()), .numberOfLines(0), .font(UIFont.systemFontOfSize(14)), .text("Lorem Ipsum has been the industry's standard dummy text ever since the 1500s")])
let redBlock = "red".build().style(Style.redBlockStyle)
let greenBlock = "green".build().style(Style.greenBlockStyle)
let blueBlock = "blue".build().style(Style.blueBlockStyle)
let blueBlock = "blue".build(UIImageView).style(Style.blueBlockStyle + [.custom(["shadowColor": UIColor.brownColor(), "shadowOpacity": 1.0])])

let blocks = Brick.union("blocks", bricks: [
redBlock.height(50),
Expand All @@ -45,4 +42,25 @@ extension DetailsViewController {

self.view.lg_configureAs(brick, updatingStrategy: .Always)
}
}
}

extension UIView {
public func lg_setupCustomStyle(style: [String: AnyObject]) {
if let view = self as? UIImageView,
let color = style["shadowColor"] as? UIColor,
let opacity = style["shadowOpacity"] as? Float {
view.layer.shadowColor = color.CGColor
view.layer.shadowOpacity = opacity
}
}

public func lg_removeCustomStyle(style: [String: AnyObject]) {
if let view = self as? UIImageView,
let _ = style["shadowColor"] as? UIColor,
let _ = style["shadowOpacity"] as? Float {
view.layer.shadowColor = UIColor.blackColor().CGColor
view.layer.shadowOpacity = 0.0
}
}
}

4 changes: 0 additions & 4 deletions Demo/LeeGo/ElementViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ struct ElementViewModel<E: Element> {
init(element: E) {
self.element = element
}

var brickDataResolver: (targetView: UIView, brick: Brick) -> () = { (targetView: UIView, brick: Brick) -> () in

}
}

extension ElementViewModel {
Expand Down
10 changes: 1 addition & 9 deletions Demo/LeeGo/LeMondeNewsFeedViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LeMondeNewsFeedViewController: UIViewController, UICollectionViewDelegateF
super.viewDidLoad()

if elements.isEmpty {
let URLRequest = NSURLRequest(URL: NSURL(string: "http://api-cdn.lemonde.fr/ws/5/mobile/www/ios-phone/en_continu/index.json")!)
let URLRequest = NSURLRequest(URL: NSURL(string: "http://api-cdn.lemonde.fr/ws/6/mobile/www/ios-phone/en_continu/index.json")!)
let task = NSURLSession.sharedSession().dataTaskWithRequest(URLRequest) {data, response, error in
if let data = data,
let optionalValue = try? NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions(rawValue: 0)) as? Dictionary<String, AnyObject>,
Expand Down Expand Up @@ -80,14 +80,6 @@ class LeMondeNewsFeedViewController: UIViewController, UICollectionViewDelegateF

super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
}

func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {

if let detailsViewController = self.storyboard?.instantiateViewControllerWithIdentifier("LeMondeNewsFeedViewController") as? LeMondeNewsFeedViewController {
detailsViewController.elements = self.elements
self.navigationController?.pushViewController(detailsViewController, animated: true)
}
}
}

extension UICollectionViewCell {
Expand Down
File renamed without changes.
31 changes: 31 additions & 0 deletions Docs/Appearance.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,34 @@ zoomScale | | | | | | | | x
bouncesZoom | | | | | | | | x
scrollsToTop | | | | | | | | x
keyboardDismissMode | | | | | | | | x

## Use custom appearance

You can also implement your self the custom appearance by overriding and implementing `UIView.lg_setupCustomStyle` & `UIView.lg_removeCustomStyle`.

```swift
let blueBlock = "blue".build(UIImageView).style([.custom(["shadowColor": UIColor.brownColor(), "shadowOpacity": 1.0])])

extension UIView {
public func lg_setupCustomStyle(style: [String: AnyObject]) {
if let view = self as? UIImageView,
let color = style["shadowColor"] as? UIColor,
let opacity = style["shadowOpacity"] as? Float {
view.layer.shadowColor = color.CGColor
view.layer.shadowOpacity = opacity
}
}

public func lg_removeCustomStyle(style: [String: AnyObject]) {
if let view = self as? UIImageView,
let _ = style["shadowColor"] as? UIColor,
let _ = style["shadowOpacity"] as? Float {
view.layer.shadowColor = UIColor.blackColor().CGColor
view.layer.shadowOpacity = 0.0
}
}
}

```

Warning: should be careful to implement these two methods as a pair, if you tell the framework how to apply a custom style, you need also to tell how to unapply this custom style. Otherwise you may have some unexpected effects.
3 changes: 3 additions & 0 deletions Docs/Layout.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
## Layout
#### Layout with built-in UIStackView inspired methods
#### Layout with raw `Visual Format Language`

TODO
2 changes: 1 addition & 1 deletion LeeGo.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "LeeGo"
s.version = "0.5.0"
s.version = "0.5.1"
s.summary = "A Swift framework that helps you decouple & modularise your UI component into small pieces of LEGO style's bricks."

s.description = <<-DESC
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<p align="center">

<a href="https://travis-ci.org/wangshengjia/LeeGo"><img src="https://img.shields.io/travis/wangshengjia/LeeGo.svg?style=flat"></a>
<a href="https://travis-ci.org/wangshengjia/LeeGo"><img src="https://img.shields.io/travis/wangshengjia/LeeGo.svg?branch=master"></a>

<a href="http://cocoapods.org/pods/LeeGo"><img src="https://img.shields.io/cocoapods/v/LeeGo.svg?style=flat"></a>

Expand Down Expand Up @@ -216,7 +216,7 @@ cell.lg_configureAs(TwitterBrickSet.standardTweet.brick(), dataSource: element[i
`Brick` is designed to be JSON convertible, which makes possible that you can control your app’s interface, from tweak some UIKit appearances to create view/cell with brand new design **remotely** via JSON payload. Please check out ["JSON encodable & decodable"](Docs/Remote.md) for more details.

## Best practices
For best practices and more design details, please checkout [More Design Details](Docs/Design.md)
For best practices and more design details, please checkout [more design details](Docs/Design.md)

## Installation
#### Cocoapods
Expand Down Expand Up @@ -245,8 +245,11 @@ $ carthage update
At last, you need to set up your Xcode project manually to add the LeeGo framework.

## Roadmap
#### Limit for the moment
There are already quite a lot cool stuffs posted in the issue list. Feel free to fire another issue for the new idea.

#### What's the next ?
## Well...
If you love this library or you have any thing want to tell me, please ping me on [Twitter](twitter.com/wangshengjia), on [Weibo](http://www.weibo.com/1739447693) or just fire the issue.

## References
I'd like to thank every one who helped me, inspired me and encouraged me. Also thank to my team @LeMonde, especially [Vincent](https://twitter.com/vipom) & Blaise.

Enjoy~ 🎉 🎉 🍻 🍻

0 comments on commit e3a0e6c

Please sign in to comment.