Swift 1.2 -> Swift 2 Conversion time - swift

Has anyone converted an app from 1.2 to Swift 2? My app is small - about 1k LOC, and its been converting for >2 hours now. I'm stuck on the following screen:
How long should I expect this to take? Thanks...

The process is long, but it shouldn't take more than several minutes.
The Swift converter is probably having an issue (e.g.: some kind of infinite loop).
You should abort and try to find what happened or maybe migrate manually.

Swift compiler has an issue with arrays. I have commented out all the elements of the array (like 10x UIColor), left only one element and conversion went smoothly.
Here's how you can debug the issue in your project:
Got to the Report navigator (CMD + 8)
Build your app, select the latest build and watch log (select All Messages filter)
The problematic file will be stuck on the compile status.
Navigate to that file and figure out what can hang the compiler (probably arrays/dictionaries).
Why build not convert? Because it's verbose.

Related

Xcode code console printing blank when using po

When I use the terminal/console to print out a value by typing po object it prints blank for all objects. This only happens for my work project which is really big and my small demo projects work fine.
Also its not happening for any of my colleagues. I was using Xcode 10.2 and upgraded to Xcode 10.3 to see if it fixes the problem.
stringValue is an extension on bool that returns "true" or "false" however this happens for all objects so I don't think the code there is relevant.
Due to the huge compile time of our app its quite time consuming to always write print(object) or debugPrint(object) in the code.
Any ideas how to fix the issue?
Can you try to press on i it does the same, but sometimes it's work for me.
Also check this out: XCode's po command has stopped working
Let me know if this help you.
Try the v command.
From the XCode release notes
The LLDB debugger has a new command alias, v, for the “frame variable”
command to print variables in the current stack frame. Because it
bypasses the expression evaluator, v can be a lot faster and should be
preferred over p or po. (40066460)

Xcode 6.3 code completion too slow

I've just updated Xcode to version 6.3. I'm working on a project in Swift with some imported Objective C code. I also use Cocoapods.
I had the same issue with the Xcode 6.3 beta. I've seen and tried all other StackOverflow answers with no luck.
So far I've tried to:
Delete ~/Library/Developer/Xcode/DerivedData and ~/Library/Caches/com.apple.dt.Xcode with Xcode and/or Mac restart.
Uninstall Spotify.
Not use the "+" concatenation operator.
Set deployment's target to 8.1.
I should mention that Objective C code autocompletes fast and that before indexing Swift code too. Esc button for popup suggestions works with the same delay.
Setting Whole Module Optimization to Yes is a workaround in my project.
In my case, the project has 5 modules, named here A, B, C, D and E, where the dependency is diagramed A -> B -> C -> D, and each of A to D refers E. With Xcode 6.3 and 6.3.1, it is fine to compile modules E and D, but it takes longer to compile C, and much longer to compile B and A, like 10 mins. After I change the project setting, it takes less than a min to compile all the modules. It looks faster than compilation with Xcode 6.2.
References:
Slow test file compilation in Swift 1.2, Xcode 6.3.1
https://devforums.apple.com/message/1128702#1128702
Try to clear project Derived Data, after update.
Window - Projects - YourProject - Derived Data - Delete...
In my case code completion is working better after update.
I used extensions on the GameScene Class and it sped everything up.
I took out three large functions from my gameScene Class, And made three separate extensions for them.
This is probably the easiest solution if none of the above work.
I got code completion down from several minutes to about 2-3 seconds for my large project.
Observation: although code completion considers 'everything' in a project, code completion was extremely slow when performed in one file and very ok when performed in another file.
The property of the slow file was one expression (filling an array with data) over several 1000 lines of code.
splitting the method with this expression up into 3 methods in 2 files (not 3 expressions in 1 method), I got the code completion speed from minutes to seconds.
It appears that there is a threshold where code completion gets slow. This is not a gradual thing where code completion gets slower and slower. It is either slow or fast. You don't have to split up your code into many methods. It is enough to get under the threshold.
This behaviour suggests a constraint in resources, maybe memory. My current machine has 16 GB memory.
So this is what you do:
check if code completion in one file is much slower than in others.
look for large or complex expressions in the slow file.
extract parts of the large expression into one or more separate methods. Probably not many extracts necessary. Start with one.
This issue appears to be fixed in Xcode 6.3.1 (released yesterday).

How can we improve our compilation flow with Specman?

We are working on a large design, for which the verification environment is complex. It contains 5 internal VIPs ( 3 of them we own and debug, doing minor changes and tweaks), CDNS unipro VIP and a low level services package we uses for all of our environments. Our e compilation flow is long and tedious, and for every change we make in our code base , our turnaround time for fixing is 10 mins.
How can we improve our compilation flow for increasing our team effectiveness?
Work in compiled mode.
Compile your code in parallel.
Use specman advance option which let you save and restore, reseed and dynamic load.
use multiple cores for much faster compilation time (-mc switch to sn_compile.sh). Requires advanced options license
Compile your code in compiled mode using multi core compilation. It will reduce the compilation time significantly.
You can use this compilation also for debugging instead of the interpreted mode.
This capability is already included in the last hotfix of your installed release.
You can compile your code. You can also use parallel compilation. Another thing you can do is to use reseed and dynamic load
Use SAO: use multi process compilation.
Download latest fix, as from version 13.1 you don't need a special verstion.
You can also use compiled code and compile only the modules you changed (multi stage compilation).
Starting version 14.1 you can compile the code to an elib file.
In addition to multiple cores compilation, from 14.1 can use elibs to prevent recompilation of modules that were not changed.
What we do for normal development is only compile the code that we will normally never change (base libraries, VIPs from other vendors, code reused from previous projects, etc.). Any code that we develop for that particular project is loaded interpreted on top. This gives a smaller turnaround time when we have to change something (because you just do a quick "reload").
For regression testing, we compile everything up to the testbench top and load the tests on top.

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.

Error because of size of function in Objective-C

I am having a weird error message when i try to build my application for device:
{standard input}:3884:invalid offset, value too big (0x00000408)
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
the class that issued this error message contains a function that has a huge switch statement with contains other switch statements in its cases. It is almost 1200 lines long!!
When i commented this function out the compilations was complete. So i predict this is whats meant by " value too big" in the error message above, correct me if am wrong.
Now how do i get over this limitation? I am thinking of a way to break my function into different parts and implement them in categories of the class in different files. But am not sure it is gonna be that easy as the function only contains switch statements within a huge statement. I will look at this further but does any one else have any other suggestion?
Cheers
AF
Firstly, if you're using xcodebuild directly try building via the IDE as some reports seem to suggest this can help, unlikely though that may sound.
Secondly, if this is a compiler bug (it sounds like it is and there are quite a few similar reports on the hyperinternetweb), you could also try switching to using LLVM (via your projects "Compiler version" settings) and see if that makes a difference.
Finally, you could simply avoid the issue by using an if/else construct instead, painful though that will be.
UPDATE
To try out LLVM (instead of gcc), select your project's build target from the "Targets" section in the Groups & Files area, alt-click and select "Get info". In the window that appears then select the Build tab (if it's not already selected) and scroll down to the "C/C++ Compiler Version" setting within the Compiler Version category. You then then choose to use "LLVM compiler" instead of gcc.