I just uploaded a video on YouTube that demonstrates how you can create a data structure, called Byte, that can hold 8 bits of data, from scratch, using Sequence. Happy watching!
I just created a tutorial on YouTube that shows you how you can create scrollable labels
I thought I’d write about operators a bit in this issue. I don’t like to teach how operators work, but rather show you some cool things that we can do with operators. but then again, many websites do that already. you can just search online and find hundreds, if not thousands of blogs/websites that can teach you how to use operators and how to create your own in Swift. so how can i be different and offer something else? well, we will talk about operators in this issue and how to write your own, but, i will also show you how custom operators are compiled by the Swift compiler.
I was informed today by O’Reilly that my title “iOS 8 Swift Programming Cookbook” videos is 50% off for a week
If you have no luck with the above link, just go to O’Reilly’s website and purchase the book with the discount code of VDWK
I have started working on a new project called Swift Weekly. The reasons behind this decision are plenty. I’ve noticed throughout years of publishing books that the best way to learn is to teach. In my quest to learn Swift better and better every day I have decided that I want to write about it. My son has recently been born so I am very busy at home too which means that I don’t have much time to write. So the weekly nature of Swift Weekly is perfect for me. Also, I believe in giving to the community so that is the third reason.
Swift Weekly issue 01 focuses on the niche subject of pointers in Swift. Swift Weekly is all hosted on GitHub and you can find it here:
Have a read through the first issue and see what you think. Ideas and suggestions are welcome. Also spread the word and share this with your Swift lover friends!
Follow these steps:
- Open Xcode
- Create a new project and select Other from under the OS X category when the dialog appears, and then choose External Build System:
- In the next page, give your project a name “product name” and then in the “build tool”, choose the path of your Python interpreter. If you don’t know where your Python interpreter is, open Terminal and type in which python to get the path to the interpreter, like so:
- Then save your project on disk
- From the Product menu, choose Scheme and then Edit Scheme or just Option-click the little Play button on top left of Xcode. Now you should see the Edit Scheme screen which looks like this:
- Now tap on the Info tab on top of the dialog and then press on the Executable combo-box (which currently says “None”) and then from the list, choose “other…”
- An open-dialog will appear waiting for you to select your build tool, again! This is a bug in Xcode. So press the Cmd+Shift+G button in the open-dialog and when the “Go to the folder” dialog appears, enter the path of your Python interpreter again like so:
- Once you are done, press the Go button and then press the Choose button
- Back in the Edit Scheme dialog, uncheck the “Debug executable option as you don’t want Xcode to attach the LLDB debugger to Python. That’s not useful. This step is very important.
- Now tap on the Arguments tab and then under the “Arguments Passed on Launch”, press the + (plus) button and then type in “test.py” without the quotation marks, like so:
- Now tap on the Options tab and then under the “Working directory” section, tap the “Use custom working directory” and then tap on the little Folder button. Once the open-dialog appears, choose the root folder of your Xcode project:
- Now press the Close button to close the Edit Scheme dialog
- Press the Cmd+N combination on keyboard or just select from the menus, File->New->File…
- In the New file dialog, from the left hand side, choose OS X and then Other and then choose Empty and then press the Next button:
- Name your file “test.py” (without the quotation marks) and then ensure that you are saving it under your project’s main folder, the same folder that you set your “Working directory” to a few steps ago. Once you are done, press the Create button.
- Write a simple Python script in your “test.py” file like so:
- Now run your application and have a look at the console in Xcode to see your Python script successfully executed:
That was it really. Good luck everyone. If you have any questions, just let me know.
A while ago I wrote on my blog about a solution to one of the most common questions asked by Objective-C programmers which is “How can I create string enumerations?”. Well, the solution that I’ve given has immediately become one of the top subjects that attracts developers to my blog, as I can see in my stats. I thought I should now take it to a whole other level and get rid of the limitations that I had presented in the old solution, and come up with a fresh perspective.
The following video is the result of my work on this subject. I hope you’ll enjoy watching it.