iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

Replace string with regex in swift

I want to replace a portion of a string that matches a regex pattern. I have the following regex pattern: (.+?)@test\.(.+?) And this is a string replacement pattern: $1@hoge\.$2 How can I use them inside Swift code?

Swift – associated types in protocol with where clause?

Consider the following: protocol SomeProtocol { typealias F: Foo typealias FB: FooBar where FB.Foo == F } But this doesn’t compile since we cannot put where clause in typealias like that. I must be missing something here since this can be easily done with type parameterization like this: struct SomeStruct<F: Foo, FB: FooBar where FB.Foo […]

Programmatically change tabBar item?

I would like to change a TabBar Item, when a User is logged in or not. For example: i have 5 different tabBar items, all created an Storyboard. Now i want to change the tarBar with index 2 (or tag == 2) when i user has no account. I would like to load a different […]

Auto layout internal error happening when a view is dismissed

I’m getting a funny error when I dismiss some views on which I have some constraints. Auto layout internal error. Cannot find an outgoing row head for incoming head AppName.ViewName:0x7fc072ed8ef0.Width{id: 6805} during optimization of variable with near-zero coefficient, which should never happen. I’m getting this bug on several views to which I’m adding these constraints. […]

XCodeBuild -exportArchive wont allow me to specify filename

I’m busy working on a Jenkins build that will be building iOS applications. I have managed to create an archive successfully with this command: xcodebuild archive -archivePath build/app.xcarchive Now I’m trying to export that archive with specifying the output file name, but can’t get this to work.In the example below I want an output file […]

How to add interactive UILabels on top of a UIImageView?

I need to add few labels on top of an UIImageView. The labels’ text can be changed by tapping on them. What is the best way to achieve this? I am using Swift programming language. Looking up some solutions on stackoverflow, I found a couple of walkthroughs that use String.drawInRect method to draw some text […]

Firebase framework not found

I’ve been trying to migrate my project to cocoapods. I feel like i’m almost there but I’m stuck in: ld: framework not found Firebase for architecture x86_64 error: linker command failed with exit code 1 (use -v to see invocation) I’m trying to compile using my “app.xcworkspace” and the project looks like this: Also: I’ve […]

How do string intervals work?

I did some playing around in this answer, and have even raised a RADAR issue with Apple, asking for better documentation on the matter (Crickets chirping). The question is this: How do String Intervals work? If you look at line 367 in my playground, you’ll see me messing with String Intervals. I extracted the String […]

Iterating through an Enum in Swift 3.0

I have a simple enum that I would like to iterate over. For this purpose, I’ve adopted Sequence and IteratorProtocol as shown in the code below. BTW, this can be copy/pasted to a Playground in Xcode 8. import UIKit enum Sections: Int { case Section0 = 0 case Section1 case Section2 } extension Sections : […]

Invalid Binary Or Invalid Swift Support

After I send my app for approval to the app store I get the message ‘Invalid Binary’ in the iTunes Connect. Then I get the following message in an email from Apple: Invalid Swift Support – The bundle contains an invalid implementation of Swift. The app may have been built or signed with non-compliant or […]