Questions for swift


3796

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:
8937

IOS:Swift: Video Screen Capture

What is the screen device called in iOS/Swift?
9924

How to structure controllers using swift?

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

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.
5450

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.
2797

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...
9142

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.
8204

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:
2877

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...
6339

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

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

Error using associated types and generics

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

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?
5939

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.
8007

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...
5465

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.
352

“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
5312

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...
5030

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
9692

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...
2791

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.
7102

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...
7256

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
5885

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 ...
168

Swift - Read plist

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

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?
4125

What is an optional value in Swift?

From Apple's documentation:
610

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:
9309

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.
6161

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.
4984

Calling NSString method on a String in Swift

Apple's Swift documentation states that
5283

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?
5518

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:
9681

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?
4084

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.
9262

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...
3840

Cannot set UIButton buttonType in initializer in Swift

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

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.
6535

isEqualToString in swift?

I am trying to run the code below:
4944

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 ...
8299

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.
4096

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...
2289

Precision String Format Specifier In Swift

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

Swift - Load storyboard programatically

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

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
6117

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 ...
5029

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.