<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blog.farly &#187; Swift</title>
	<atom:link href="http://blog.farly.de/tag/swift/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.farly.de</link>
	<description>distorted noise</description>
	<lastBuildDate>Tue, 24 Mar 2015 12:42:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Captain on the bridge</title>
		<link>http://blog.farly.de/captain-on-the-bridge/</link>
		<comments>http://blog.farly.de/captain-on-the-bridge/#comments</comments>
		<pubDate>Thu, 15 Jan 2015 20:00:19 +0000</pubDate>
		<dc:creator><![CDATA[jan]]></dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[swift]]></category>
		<category><![CDATA[Swift]]></category>

		<guid isPermaLink="false">http://blog.farly.de/?p=36</guid>
		<description><![CDATA[<p>How to fix &#8220;Method does not override&#8221; when subclassing UIGestureRecognizer So I tried to create an UI Element in Swift that responds to a specific Gesture. Easy enough let&#8217;s look up how that works. The almighty Internet has answers for everything: Subclass UIGestureRecognizer and override the methods touchesBegan, touchesMoved and touchesEnded. Okay, I can do that &#8211; but wait, &#8230; <a href="http://blog.farly.de/captain-on-the-bridge/" class="more-link">Continue reading <span class="screen-reader-text">Captain on the bridge</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.farly.de/captain-on-the-bridge/">Captain on the bridge</a> appeared first on <a rel="nofollow" href="http://blog.farly.de">blog.farly</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h2>How to fix &#8220;Method does not override&#8221; when subclassing UIGestureRecognizer</h2>
<p>So I tried to create an UI Element in Swift that responds to a specific Gesture. Easy enough let&#8217;s look up how that works. The almighty Internet has answers for everything:</p>
<p><em>Subclass UIGestureRecognizer and override the methods <code>touchesBegan</code>, <code>touchesMoved</code> and <code>touchesEnded</code>.</em></p>
<figure id="attachment_40" style="width: 660px;" class="wp-caption alignnone"><a href="http://blog.farly.de/wp-content/uploads/2015/01/Bildschirmfoto-2015-01-14-um-21.14.15.png"><img class="wp-image-40 size-large" src="http://blog.farly.de/wp-content/uploads/2015/01/Bildschirmfoto-2015-01-14-um-21.14.15-1024x68.png" alt="override func touchesBegan - Method does not override any method from its superclass" width="660" height="44" /></a><figcaption class="wp-caption-text">Method does not override any method from its superclass &#8211; wat?</figcaption></figure>
<p>Okay, I can do that &#8211; but wait, what?</p>
<p>It seems like the most recent version of Swift is missing some <code>public</code> declarations for those override-able methods. Probably because access control has just landed for Xcode/Swift the other day. At least <a href="http://blog.jaredsinclair.com/post/93992930295/for-subclass-eyes-only-swift">Jared Sinclair supports this theory</a>.</p>
<p>He also offers a Solution: Import UIGestureRecognizerSubclass.h in your Bridging-Header. I am new to this, how do you do that? Turns out Xcode creates the Bridging-Header file for you if you create an Objective-C file in your project. Due to some back and forth I learned that it unfortunately only does that once. If you ever deleted the file it will not come back. So how do you create it manually?</p>
<ol>
<li>Create a new Objective-C Header file and name it <code>&lt;projectName&gt;-Bridging-Header.h</code></li>
<li>Go to your Project Root and then find &#8220;Build Settings&#8221;</li>
<li>Scroll all the way down and locate the &#8220;Swift Compiler &#8211; Code Generation&#8221; section</li>
<li>Insert the path to your header file into the &#8220;Objective-C Bridging Header&#8221; field (Notice that the file might be in the root folder [like mine] or somewhere else)</li>
<li>Set &#8220;Install Objective-C Compatibility Header&#8221; to true</li>
</ol>
<figure id="attachment_41" style="width: 660px;" class="wp-caption alignnone"><a href="http://blog.farly.de/wp-content/uploads/2015/01/Bildschirmfoto-2015-01-14-um-21.30.49.png"><img class="size-large wp-image-41" src="http://blog.farly.de/wp-content/uploads/2015/01/Bildschirmfoto-2015-01-14-um-21.30.49-1024x158.png" alt="Objective-C Bridging Header" width="660" height="102" /></a><figcaption class="wp-caption-text">My Settings for the Bridging Header</figcaption></figure>
<p>Back to the actual solution. Insert this one line into the header file:</p>
<p>https://gist.github.com/552655716a2016b11566</p>
<p>And voila &#8211; it works. Suddenly all the desired Methods are avaiable. Well, that was simple.</p>
<p>The post <a rel="nofollow" href="http://blog.farly.de/captain-on-the-bridge/">Captain on the bridge</a> appeared first on <a rel="nofollow" href="http://blog.farly.de">blog.farly</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.farly.de/captain-on-the-bridge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hashtag Swift</title>
		<link>http://blog.farly.de/hashtag-swift/</link>
		<comments>http://blog.farly.de/hashtag-swift/#comments</comments>
		<pubDate>Wed, 14 Jan 2015 16:14:07 +0000</pubDate>
		<dc:creator><![CDATA[jan]]></dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[swift]]></category>
		<category><![CDATA[Swift]]></category>

		<guid isPermaLink="false">http://blog.farly.de/?p=12</guid>
		<description><![CDATA[<p>I recently started developing for iOS using Swift. I did a little project creating a simple tic tac toe app nearly a year ago. Written in Objective-C obviously, because Swift hasn&#8217;t been around back then. I remember being stunned by the weirdness the language had to offer; especially coming from a php and javascript background. Let &#8230; <a href="http://blog.farly.de/hashtag-swift/" class="more-link">Continue reading <span class="screen-reader-text">Hashtag Swift</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.farly.de/hashtag-swift/">Hashtag Swift</a> appeared first on <a rel="nofollow" href="http://blog.farly.de">blog.farly</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>I recently started developing for iOS using Swift. I did a little project creating a simple tic tac toe app nearly a year ago. Written in Objective-C obviously, because Swift hasn&#8217;t been around back then. I remember being stunned by the weirdness the language had to offer; especially coming from a php and javascript background. Let me give you a little example:</p>
<p>https://gist.github.com/1448a92686ee40cb7db6</p>
<p>For people that do not know Objective-C let me guide you through this a litte. This is the implementation of a class method named <code>getFieldTextAtRow:andCol:</code>. It takes to Integers (row and col) and returns an NSString. In the return statement the class method <code>getFieldAtRow:andCol:</code> is called passing the two variables into it. It then asks for the <code>.text</code> property of the returned object. Wow. Calling Methods on an object requires some strange square bracket syntax. Accessing parameters on the other hand is just a plain simple <code>Object.parameter</code>. A dash defines a method. A simple String is a NSString (which is written as <code>@"String"</code>) and method name and parameters are entangled. I could go on&#8230; but, lets not ramble about dem ol&#8217; days too much: Along comes Swift.</p>
<blockquote><p>Swift is an innovative new programming language for Cocoa and Cocoa Touch. Writing code is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast.</p></blockquote>
<p>Let&#8217;s look at the example Method again &#8211; this time written in Swift:</p>
<p>https://gist.github.com/d61634ebbf747715e0cd</p>
<p>A String is a string; A method is defined with a <code>func</code> keyword and a method is called just like a function. The name of the method is just <code>getFieldText</code>. Because of backwards compatibility (I guess) parameter names are still in the call. Exception to the rule is the first parameter. Objective-C had it inside the first part of the method name, so Swift &#8220;needs&#8221; to do that too. <code>func getFieldTextForRow(row: Int, col: Int) -&gt; String</code> would be called like <code>getFieldTextForRow(13, col: 37)</code>. The hash symbol in front of the first parameter tells the compiler, that you do want to explicitly name it. So basically that number sign makes stuff more consistent and a little less awkward. I tend to use it all the time.</p>
<p>After all Swift lets you do very cool stuff and in some aspects it is miles ahead of other languages. But some of the &#8220;I-need-to-support-all-the-weirdness-of-my-grumpy-father&#8221;-aspects just leave me scratching my head.</p>
<p>The post <a rel="nofollow" href="http://blog.farly.de/hashtag-swift/">Hashtag Swift</a> appeared first on <a rel="nofollow" href="http://blog.farly.de">blog.farly</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.farly.de/hashtag-swift/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
