Swift Compile Error: does not conform to protocol - swift

I am using the Cocoapod Money (version 2.0.1). When I try to build it, I get the error "Type _Decimal does not conform to protocol 'Numeric'" Any ideas as to how to fix it?
I've already tried removing and reinstalling the cocoapod.
Thanks,

Sounds like you’re using a Numeric number while the pod wants an decimal number. Just try to cast your numeric in decimal and it should work.

According to the pod's .swift-version it is written in Swift 3. My guess is that the build error results from a conflict in Swift versions with the current Xcode. The project is no longer maintained but according to this issue there is a branch which should make it buildable on Xcode 9.

Related

How to create a type alias in Flutter?

I have seen some old questions/answers that said it's impossible to create a type alias on Flutter. I just want to make sure whether it's the case, as the language seems to have been updated numerous times since.
My specific question is, how can I make a type alias like this:
typealias Json = Map<String, dynamic>;
?
Or is there any workaround, because I've tried to use empty mixin to do this but it says that there are 18 missing method implementations.
Small update on Randai Schwartz's comment.
The feature seems (as of April 2021) almost ready and will probably be released in the next minor version or the one after it.
When you read this, it is probably worth checking the following issue:
https://github.com/dart-lang/language/issues/65
This should allow to do:
typedef NewTypeName = OldTypeName;
Update:
Flutter officially supports now typedefs. :)
So you can just use my code example above.
At this point, typedefs are supported only for Function types (https://dart.dev/guides/language/language-tour#typedefs). There is talk of adding more, but not any time soon (https://github.com/dart-lang/language/issues/115).
Flutter 2.2 has been released together with Dart 2.13, now SimonEritsch code should work as you wanted as long as you run flutter upgrade on your terminal or upgrade your dart.

How to get swift mangled object name

I've learned that swift actually creates a naming method called "mangling" used internally for all objects.
All threads talk about demangling, but how to actually get the mangled name?
i've tried
1- object_getClass(self)
2- NSStringFromClass(MyClass.self)
but they return the normal class name.
I've found this demangle project..
https://github.com/mattgallagher/CwlDemangle/blob/master/CwlDemangle/CwlDemangle.swift
is there a mangling project maybe?
Note: Im using swift 3.0.1
xcode ships with a command line tool to de-mangle names.
Type in:
swift demangle
Then find your mangled class name..
__TMaC17find_the_treasure15YD_Secret_Class
Then watch it spit out the name..
find_the_treasure.YD_Secret_Class
If you want to observe the mangled names, as you asked, you can put the produced Swift iOS or macOS binary into a dissassembler like Hopper, iDAPro or radare2.
The tools to automatically de-mangle names are already here (refer to Hopper v4.0 Dissassembler).

Error when trying to check for internet access with Reachable.h/.m

I have imported Reachable and followed the chosen anser on this thread: Reachability Guide for iOS 4 Everything looks good, apart from a yellow triangle saying "incomplete implementation". Then when I press run I get ten red errors coming from the Reachable.m file, saying things like "ARC forbids explicit message send of release', 'NSAutoReleasePool is unavailable in automatic counting reference mode' and 'Cast of C pointer of type 'void ': to objective-c pointer type 'Reachability' etc. and 'declaration of 'struct sockaddr_in' will not be visible outside of this function [3]' from the Reachable.h file. Any ideas? Maybe the Reachable files are out of date? I have no experience with using C data types etc. and whenever I have to import an extra implementation/header file things seem to go wrong :/.
Apple's Reachability sample code was last updated in 2010. It doesn't use ARC and contains code that is non-trivial to convert to ARC.
The solution is simple:
Set the -fno-objc-arc compiler flag for that file.

Cocos2D and Xcode 4 - Compiler errors using templates

I just installed the cocos2d templates in Xcode 4. When I create a new project from the template and run it, it shows around 30 compiler errors. Even without making any changes to the template. Do you have any idea what is wrong?
Please add some more information about errors, but it looks like you forgot to add to your project OpenGLES and QuartzCore frameworks. I could be wrong...
I just spent 10 or 15 minutes plus fixing a bunch of errors in this situation, so i will guess: moving to Xcode 4.X caused many problems for cocos2d projects (including Kobold2D) and most of them require putting "(unsigned int)" in front of an argument in a list of arguments to a 'string with format' type operation creating mostly debug type output. usually the argument in question is "self", but sometimes just other "types" that resolve to (or can) unsigned ints. in a few cases I had no arguments but a reference to the error string to %#; these required adding a ", self" between the end of string and the close paren. in about 5 to 10% of cases, "fixits" were provided to automate the correction (usually changing the format character to match the argument). Hope this helps! Happy to provide examples if this actually helps anyone.

iPhone Dev: error: cannot find protocol declaration for 'NSXMLParserDelegate'

I've got an Xcode project that I know works, but when I try to build it on a different machine, I get this error:
error: cannot find protocol declaration for 'NSXMLParserDelegate'
along with about 90 other random syntax errors. I wonder if it has something to do with the build configuration? Because I can't think what else would've changed.
Appreciate any input, thanks!