-
Notifications
You must be signed in to change notification settings - Fork 460
fix: replaced AnyObject with Any #725
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
Merged
JeneaVranceanu
merged 16 commits into
web3swift-team:develop
from
JeneaVranceanu:fix/anyobject-usage-removed
Feb 2, 2023
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d5df8e2
fix: removed the use of AnyObject in all places possible - replaced w…
JeneaVranceanu 79886de
fix: ERC20BaseProperties are back to inherit from AnyObject (restrict…
JeneaVranceanu 6534980
fix: some spacing and docs fixed
JeneaVranceanu 093218c
Merge branch 'develop-upstream' into fix/anyobject-usage-removed
JeneaVranceanu 15f7770
fix: Networks.fromInt must not return optional
JeneaVranceanu a49f771
fix: EIP681 - when parsing arguments chain ID must be defaulted to Ma…
JeneaVranceanu af66469
chore: removed redundant `parameters: []` in read operation
JeneaVranceanu 922da41
fix: spacings
JeneaVranceanu 03f1395
chore: removed spacing in `" )`
JeneaVranceanu 8e92566
fix: removed as AnyObject from ENS related code
JeneaVranceanu c448970
chore: replaced [Any]() with [] for default parameter value
JeneaVranceanu 2bd3303
chore: test refactoring - checking for nullability by using XCTAssert…
JeneaVranceanu ed43d2d
fix: RLP func encode for single value has named parameter
JeneaVranceanu a17a5bb
fix: ENS parsing requires chainID if an ENS address is expected to be…
JeneaVranceanu f6c1805
chore: merge with develop
JeneaVranceanu be6c585
chore: EIP681 docs + more descriptive log message
JeneaVranceanu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that in some places you drop a type erasure totally, while in others you've left it, but change the target type to
Any
? Within my review I assume that you do this in following logic: in case if type erasure it was removed, in case its required target type has ben set toAny
. Tell me if i'm wrong with that, resolve this otherwise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please provide one or more examples where I did the following:
I'll start to self-review this PR only now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To remove any misunderstanding: the goal I had in mind is to eliminate the use
AnyObject
as much as possible. I simply performed the replacement ofAnyObject
withAny
, ran the tests, fixed almost all issues that occurred (except ENS tests) and opened this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AnyObject
uses bridged types and basically changes the type of the object when it can.For example:
String
->NSString
;Int
->NSNumber
;Array
->NSArray
;struct
->__SwiftValue
;While using
Any
we preserve this information.And this is where it gets important!

When we have
Int8
,Int16
,Int..
andUInt[8-64]
these all get represented asNSNumber
if we cast them toAnyObject
. And here is an example of what will happen:We do not want to represent
Int8
asInt
or the other way around.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I've finally got the point. AnyObject is about bridging swift types to an Obj-C one, but with type erasure. Guess it's some internal apple demand at its most.