Questions for swift


UICollectionView orientation change mishap?

When my collection view is at the bottom and i change it from portrait to landscape, the cells disappear out the view, until I have to drag them down, like so:

IOS:Swift: Video Screen Capture

What is the screen device called in iOS/Swift?

How to structure controllers using swift?

I want to build an app using swift with the following structure:

Fit CustomView into SuperView with Autolayout

I'm trying to create a card view that flips based on this tutorial. It creates a UIView and adds the card view.

INFINITY in Swift Lang

According to Apple's documentation, Swift doesn't support preprocessor directives. In C/Objective-c the "INFINITY" definition is very useful for some checks.

How to create NS_OPTIONS-style bitmask enumerations in Swift?

In Apple's documentation about interacting with C APIs, they describe the way NS_ENUM-marked C-style enumerations are imported as Swift enumerations. This makes sense, and since enumerations in Swi...

How do I display my timer in my SKLabelNode?

The score of my game depends on the time you have stayed alive. Although my output log displays the timer counting up, the SKLabelNode stays at 0 on the screen.

How do I set adaptive multiline UILabel text in a swift ios project?

I have a UILabel named titleLabel in my storyboard nib set to its default height. I want it to programatically expand in height to fit it's content. Here is what I have tried so far:

Region Did Changed Accuracy

I have MKMapView and I need to do some action on func mapView(mapView: MKMapView!, regionDidChangeAnimated animated: Bool). But this action is very hard to proceed every time when region changed, a...

Error “extra argument in call” when passing argument to method

I am trying to write the following Objective-C code in swift:

Error using associated types and generics

The following code gives me an error on line return The error says: 'P' does not have a member named 'foo'.

Swift: Subclassing a UIViewController's root view

tl;dr: How can I tell Swift that I'm overriding MyViewController's view property with a subclass of UIView?

Cannot animate smoothly a TableView to new cells inserted at the bottom

I have an Swift application that generates information every few seconds and adds it to a ManagedObjectContext.

CommonHMAC in Swift

I'm trying to create a HMAC SHA-1 hash of a string in Swift but can't figure out how to interact with the APIs as it doesn't seem to be importing the CommonCrypto framework. I've tried various diff...

How to make WKWebView not scrollable without a URL loaded in Swift?

When I launch my browser app, it displays the address bar and the WKWebView, but doesn't have a URL loaded.

“Attempt to delete row from section 1, but there are only 1 sections before update”

I'm trying to delete the rows that don't meet the criteria in the for loop. However, I'm getting and error that says: 'attempt to delete row 0 from section 1, but there are only 1 sections before the

swift How to use enum as parameter in constructing struct?

I was doing an experiment of Swift programming book and stuck with construct a struct inner the struct itself. But the error reported the parameter is unwrapped. How could I take it value as parame...

Two different types of nil in Swift?

I have encountered some strange behaviour in the Swift language when working in the REPL (=Read-Eval-Print-Loop) where there seem to be two different types of nil values with different behaviour at

How to enable DELETE MODE in iOS coredata sqlite using swift

I am learning iOS database creation using CoreData. I created sample application to understand the CoreData.I extracted the Sqlite file from default database creation directory to check the data us...

Swift - Populating UITableView with data from API

I am trying to set up a feed page with a UITableView, retrieving all the JSON data from Node.js API.

How to show result on different view controller in Swift?

I have 3 UIViewControllers and I have UIButtons in the first 2 UIViewControllers. I want do an addition math problem on the first two and then I want the results to display on the 3rd UIViewControl...

Xcode 6 Beta / Swift - Playground not updating

I was playing around with the Playground feature of Xcode 6's first beta - and I notice half the time the Playground doesn't update (simply doesn't display the result calculation or how many loop

Move SKSpriteNode until touches ended

I created this game in Spite Kit in Swift. I create a ship that I can determine its location be touching above or underneath the location of the ship. The ship will move towards the Y axis where I ...

Swift - Read plist

I am playing around with Apple's new Swift programming language and have some problems...

Cropping image with Swift and put it on center position

In Swift programming , how do you crop an image and put it on the center afterwards?

What is an optional value in Swift?

From Apple's documentation:

Swift compiler error: “non-modular header inside framework module”

Now I would like to migrate my ObjC framework to Swift and I got the following error:

iOS using xib + global methods for overlay UIView (Swift)

I'm writing an app that should present overlays in specific situations, like for example the lack of location services enabled for the app.

Disable Selection For WatchKit TableRow

Perhaps I'm overlooking the proper usage in Apple's documentation, but I am trying to figure out how to programmatically disable only certain rows in a WatchKit table.

Calling NSString method on a String in Swift

Apple's Swift documentation states that

NavigationBar bar, tint, and title text color in iOS 8

The background text in the status bar is still black. How do I change the color to white?

Why do I get an error when declaring a constraint programmatically in Swift?

I am declaring a constraint inside a UIViewController class called Home. Here's what the code looks like:

Which version of xcode supports “Swift programming language”?

Apple introduced a new programming language for iOS 8 / OS X. Which version of xcode supports Swift?

Convert array items to string on condition - Swift

I am trying to create a file name from the URL. I have to forcefully remove the first item in the array every time. Like the C# implementation where they check for empty string.

UITableViewCell Images Changing after Scrolling Up and Down but TextLabel Text Remain Same (iOS8, Swift)

I'm trying to create an RSS app for practice. So my tableView cell has both textLabel and image. My textLabel's text and image data come from a dictionary stored in Core Data. Some cells have image...

Cannot set UIButton buttonType in initializer in Swift

I want to subclass a UIButton in Swift. I get an error when setting buttonType

Swift - How to copy an array that contains reference types

I am trying to copy an array and its values. Why are both arrays referencing the same variable? You can try this in Playground.

isEqualToString in swift?

I am trying to run the code below:

SwiftyJSON keeps returning empty objects

I am new to SwiftyJSON, and I'm having some trouble with it. I can get it to return the entire JSON file as a string, but the moment I try to parse it, I keep getting empty variables back, and I'm ...

Is there a way to get the intensity of shaking?

I am doing a POC to see if i can find the intensity of shake.

Xcode Error: Outlets cannot be connected to repeating content

After doing some searching and editing, I can't seem to find a solution to fixing this error. I'm trying to link my location search results with a table to display the search results in a list-form...

Precision String Format Specifier In Swift

Below is how I would have previously truncated a float to two decimal places

Swift - Load storyboard programatically

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

How to return asynchronous request's callback result to the function?

I am trying to return the data from a asynchronous request's callback like below , but it's obviously not working . I want return the value inside the callback block to the main function , and other

NSURLConnection crashing the app

I am downloading Json data from server using NSURLConnection class. I parse the data in background thread, however in connection() delegate method the app is crashing. Below is the screenshot. The ...

Sending emails - MFMailComposeResult

I'm trying to migrate one of my applications from Obj-C to Swift and I've a problem with the emails management.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.