Dynamic Member Lookup introduced in Swift 4.2, now we can use dot, in…#1132
Closed
gsmalleySDC wants to merge 1 commit intoSwiftyJSON:masterfrom
gsmalleySDC:xcode10.0
Closed
Dynamic Member Lookup introduced in Swift 4.2, now we can use dot, in…#1132gsmalleySDC wants to merge 1 commit intoSwiftyJSON:masterfrom gsmalleySDC:xcode10.0
gsmalleySDC wants to merge 1 commit intoSwiftyJSON:masterfrom
gsmalleySDC:xcode10.0
Conversation
…stead of brackets (#986) * This proposal introduces a new @dynamicMemberLookup attribute. Types that use it provide "dot" syntax for arbitrary names which are resolved at runtime - in a completely type safe way. This provides syntactic sugar that allows the user to write **[introduce-user-defined-dynamic-member-lookup-types]**(https://github.com/apple/swift-evolution/blob/master/proposals/0195-dynamic-member-lookup.md#introduce-user-defined-dynamic-member-lookup-types) i've added a subscript function with dynamic member, so users can use dot instead of [], ``` let name = json.name The same as: let name = json["name"] let phoneNumber = json.user.contactInfo.phoneNumber The same as: let name = json["user"]["contactInfo"]["phoneNumber"] ``` * resolve houndci-bot conversation * update swift version to 4.2 * change travis swift version to 4.2.0 * set travis simulator ios version * check for ios 12 * redu changes to travis.yml * new test file added, DynamicMemberLookupTests.swift * email address changed to some random email address * remove a test because it was duplicate * resolve hound comma
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…stead of brackets (#986)
[introduce-user-defined-dynamic-member-lookup-types](https://github.com/apple/swift-evolution/blob/master/proposals/0195-dynamic-member-lookup.md#introduce-user-defined-dynamic-member-lookup-types)
i've added a subscript function with dynamic member, so users can use dot instead of [],
```
let name = json.name
The same as: let name = json["name"]