Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

toUIntMax() and toIntMax() removed from Swift 4

What has replaced the method toUIntMax() and the method toIntMax() in Swift 4 ? The error occurred within the FacebookCore framework.

Any help would be appreciated

like image 909
techcoderx Avatar asked Jun 24 '17 14:06

techcoderx


2 Answers

The concept of IntMax has been completely removed as part of SE-104.

Converting from one integer type to another is performed using the concept of the 'maximum width integer' (see MaxInt), which is an artificial limitation. The very existence of MaxInt makes it unclear what to do should someone implement Int256, for example.

The proposed model eliminates the 'largest integer type' concept previously used to interoperate between integer types (see toIntMax in the current model) and instead provides access to machine words. It also introduces the multipliedFullWidth(by:), dividingFullWidth(_:), and quotientAndRemainder methods. Together these changes can be used to provide an efficient implementation of bignums that would be hard to achieve otherwise.

In this specific case FB SDK should simply use the UInt64($0) initializer which is now available for any BinaryInteger type thanks to the new protocols.

like image 66
Sulthan Avatar answered Oct 20 '22 08:10

Sulthan


You can also for now, can select Swift 3.2 under Pods -> Targets -> ObjectMapper -> Swift language version option

like image 33
Sushmita Sinha Avatar answered Oct 20 '22 06:10

Sushmita Sinha