Quite often I find myself in the Terminal and want to open Xcode with the project in the current directory:
> open CurrentProject.xcodeproj
This works just fine, of course, but with the following alias (added to ~/.cshrc), I don’t need to know the name of the project, assuming there is always only one project in the current directory:
> alias xcode '\ls | grep xcodeproj | xargs open' > xcode
N.B. The use of ‘\ls’ ignores the alias that I have for ‘ls’. Instead of “ls *.xcodeproj”, the pipe via grep avoids errors like “ls: No match.”.
P.S. Knowing the name of the project is actually not the problem; since there are multiple items named “Current*” or “CurrentProject*” in the same folder, the issue is that I can’t just type “open SHIFT+C<TAB><CR>” (where pressing TAB autocompletes the name); instead, I have to type: “open SHIFT+C<TAB>SHIFT+P<TAB>.x<TAB><CR>”.
Puzzled by a crash in my application, on a line of code that looked reasonable, it became necessary to dig a little deeper in how some of my Decimal numbers are created:
let newValue = Decimal.init(binary.maskedUInt64Value)
After testing a series of different 64-bit integer values, I found this:
(lldb) po Decimal.init(UInt64.max - 1024) ▿ 18446744073709547520 ▿ _mantissa : 8 elements - .0 : 38912 - .1 : 39321 - .2 : 39321 - .3 : 6553 - .4 : 0 - .5 : 0 - .6 : 0 - .7 : 0 (lldb) po Decimal.init(UInt64.max - 1023) error: warning: couldn't get required object pointer (substituting NULL): Couldn't load 'self' because its value couldn't be evaluated error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0). The process has been returned to the state before expression evaluation.
Similar to what I have been doing with subversion, I now also create backups for my git repositories.
I like Jonathan Penn’s screen shooter scripts to automate the recording of screen shots for different iOS devices (screen sizes) as well as for multiple localisations (languages). Having said that, creating the automation scripts can be a pain and maintaining them with every change of the UI can be a real nuisance. …Breathe In… Sigh!
The trouble that I am addressing today, however, is about the resulting images. In my scripts, the screen shots are generated by calling either
UIATarget.captureScreenWithName() or its sister function:
UIATarget.captureRectWithName(). Sometimes, the images can look as if only partial, corrupted screens have been rendered.
This is what I now use to auto-generate the default Main.strings file for my “Base”-localized storyboard.
Basically, whenever the storyboard file is updated, I re-generate the strings file. Most of the time, the resulting strings file doesn’t change, but when it does, I use Xcode’s version editor to highlight the changes since my last (version control) check-in. I can then make the appropriate changes to the other strings files for all the languages that the project supports.
Here is the build-phase script to Xcode: [Read More…]