Giter VIP home page Giter VIP logo

coolie's Issues

产生UnknownType类型无法识别

当传入值为null的时候。 使用苦力创建的代码,对应的类型为UnknownType? 此时无法识别类型,报错。
烦请修正

测试JSON
{ "location": null }

产生的代码
struct Photo {
let location: UnknownType?
static func fromJSONDictionary(info: [String: AnyObject]) -> Photo? {
let location = info["location"] as? UnknownType
return Photo(location: location)
}
}

错误提示信息为: Use of undeclared type 'UnknownType'

发现一个问题

类似于这样的json
{ "error": "", "count": 10, "posts": [ { "id": "1853", "date": "2016-02-18", "name": "archive", "pic": "http://www.kanzhihu.com/wp-content/uploads/2016/02/archive-2016-02-18.jpg", "publishtime": "1455786000", "count": "32", "excerpt": "摘录了『人这一生为什么要努力?』、『日本究竟发达到什么程度?』、『野球场上,你见过最装逼的是什么?』、『什么是 Vim 可以做而 Emacs 做不到的?』、『吃过最好吃的东西是什么?』、『文案的价值在哪里?为什么凭几句广告语就能拿那么多工资?』、『27岁女生,单身,无学历无背景,现在感到很迷茫?』、『如果炉石传说里的随从或职业玩知乎,他们会提什么问题?』、『你遇过的最温暖的瞬间是什么?』、『为什么要使用 Go 语言?Go 语言的优势在哪里?』等问题下的32个答案" }, { "id": "1844", "date": "2016-02-15", "name": "archive", "pic": "http://www.kanzhihu.com/wp-content/uploads/2016/02/archive-2016-02-15.jpg", "publishtime": "1455526800", "count": "32", "excerpt": "摘录了『有哪些物美价廉的淘宝店值得推荐?』、『北欧究竟发达到什么程度?』、『外蒙古地区独立对我国是利大于弊还是弊大于利?』、『怎样可以像法国女人一样优雅?』、『你家猫最逗比的时刻是什么时刻?』、『你是怎样通过学习改变命运的?』、『给认识不久的妹子准备一个什么圣诞礼物比较合适?』、『有哪些著名的「我秃了,也变强了」的人物?』、『什么样的讲话算「有水平」?』、『你见过最丑的设计是什么?』、『作为 Airbnb 房东,你对自己出租的空间有哪些装点心得?』等问题下的32个答案" } ] }
使用命令 ./coolie zhihu.json User
会出现错误
Not found valid token fatal error: Array index out of range [1] 21517 illegal hardware instruction ./coolie zhihu.json Users

can't build

xcrun: error: active developer path ("/Applications/Xcode-beta.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select)

Invalid characters in generated Swift structs

Awesome project!

One thing I noticed (if only because it affected me): if a JSON key has a character that is unable to be within a Swift variable, such as "/", the generated Swift code does not account for it.

E.G.

{ "some_variable/_text" : "hello, world" }  

becomes

let someVariable/Text: String

which is invalid

About the command

Awesome. Thank you nixzhou.

$ xcrun swiftc Sources/*.swift -o coolie
$ ./coolie test.son User

Above command line need alias the xcrun line by putting this line in your .bash_profile first
alias swiftc='xcrun -sdk macosx swift'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.