Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

John Sundell 的 Swift Tips 更新了 #53 —— 使用字符串枚举时的字符串交互小技巧 #12

Closed
lacklock opened this issue Dec 29, 2017 · 3 comments
Assignees

Comments

@lacklock
Copy link
Member

https://github.com/johnsundell/swifttips#53-string-based-enums-in-string-interpolation

@lacklock
Copy link
Member Author

没看懂这个的使用场景 @kemchenj

@kemchenj
Copy link
Contributor

kemchenj commented Jan 1, 2018

@lacklock 这一个我仔细想想,可能作用也不是很大,只能说是后端用 CN,US 之类的简写时,可以少写一个 fullName 属性,直接写为枚举值的名字而已

enum Country: String {
    case china = "CN"
    case canada = "CA"
}

print("\(Country.china)") // "china"

这一个技巧算是可有可无,但国内好像没有类似于 Swift Tips 这个项目,而且这个项目里一些技巧还是挺不错的,我觉得可以改成介绍这个项目

@kemchenj kemchenj self-assigned this Jan 3, 2018
@kemchenj
Copy link
Contributor

kemchenj commented Jan 3, 2018

跟前面 iOS Tips 小集类似的项目,不同的是这个项目里讲的是一些 Swift 的小 Tips,里面 #7#22 等技巧我都有实际用于项目中,非常推荐大家看一下

@kemchenj kemchenj closed this as completed Jan 3, 2018
raozhizhen added a commit that referenced this issue Mar 25, 2018
raozhizhen added a commit that referenced this issue Mar 25, 2018
mmoaay added a commit that referenced this issue Mar 25, 2018
Awhisper added a commit that referenced this issue Mar 25, 2018
Awhisper added a commit that referenced this issue Mar 25, 2018
Awhisper added a commit that referenced this issue Mar 25, 2018
Awhisper added a commit that referenced this issue Mar 25, 2018
Awhisper added a commit that referenced this issue Mar 25, 2018
aaaron7 pushed a commit that referenced this issue Mar 25, 2018
aaaron7 pushed a commit that referenced this issue Mar 25, 2018
raozhizhen added a commit that referenced this issue Mar 26, 2018
waz0820 added a commit that referenced this issue Jan 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants