swift2

Swift Version 2 Bool [closed]

喜欢而已 提交于 2019-12-13 09:46:40
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I'm having trouble with creating an app in Swift2. The App has an image of a wolf which changes every 0.4 seconds to reveal a running wolf. However I have Bool errors in Swift 2 that I cannot fix. I also have issues with declaring a void function. Any help would be appreciated.

Counting Vowels in Swift [closed]

萝らか妹 提交于 2019-12-13 09:15:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I have done this successfully in Java and C++ but can't figure it out in Swift. Here is my C++ code: int count_vowels (string input) { int position = 0; for (int i = 0; i < input.length(); i++) { char ch; ch = input[i]; if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'){ position++; } } return

SWrevealviewcontroller : Switch slideout menu direction from left to right pragmatically

那年仲夏 提交于 2019-12-13 09:02:36
问题 I working on app which have two language (English and Arabic) , I have implement slide out menu using "SWrevealviewcontroller" lib for left side, I want to switch slide out menu to right side form left side on language change (Arabic) and switch back again to right side to left for english language. How can we archive it? Thanks 回答1: Actually you must to get the application language, let's say you have Helper class and put static method to get the language of the application. Helper.m +(void

why drand48 () show same value in each run in my program?

会有一股神秘感。 提交于 2019-12-13 08:58:18
问题 I try to create a variable to get value random with drand48 () but in each run my variable take a same value . can anybody help me , (i want in each run my variable take different value) ??? let number = drand48 () 回答1: drand48 creates a Pseudo-random number sequence. That is if it is not set to a different start point each time it will always produce the same numbers. To fix this call srand48 beforehand to set a new start point for drand48 Eg let time = UInt32(NSDate()

How to reduce few minutes for current date in Swift 2.0 [duplicate]

白昼怎懂夜的黑 提交于 2019-12-13 08:50:32
问题 This question already has answers here : How to add minutes to current time in swift (9 answers) Closed 4 years ago . How can I reduce 5 or 10 minutes from current time and then store it as date format in Swift 2.0 ? let now = NSDate() var reducedTime = ???? \\ Here I want 10 minutes reduced from current time. If current time is 02:20:00, then reducedTime should be 02:10:00 How can I do this in a simplest way ??? 回答1: You can use calendar method dateByAddingUnit and subtract 10 minutes fro

how to use and send email using mime in swift

若如初见. 提交于 2019-12-13 08:45:39
问题 I am new to swift and i am using swift version 2.2. I want to send an email using swift mime. For this, I have go through this link http://swiftmailer.org/docs/messages.html But I can not use require_once 'lib/swift_required.php' in my swift code. How can I use this in my osx swift project? 回答1: Apple's SBSendEmail Framework is documented with a sample project. The interface for the Controller class includes a sendEmailMessage: method. @property(retain, readwrite) NSTextField *toField;

Cannot convert jsonArray element to integer

假如想象 提交于 2019-12-13 08:38:21
问题 do{ let resultJSON = try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions()) let arrayJSON = resultJSON as! NSArray let success:NSInteger = arrayJSON["success"] as! NSInteger if (success == 1 ) .... json data is the response from the server, i am trying to convert it to integer but i get the conversation error. 回答1: This is a working exmaple (tested on my machine) let task = session.dataTaskWithRequest(request, completionHandler: {(data, response, error) in if let

xcode 7: error: editor placeholder in source file

爷,独闯天下 提交于 2019-12-13 08:31:33
问题 I am trying to create a button on apple maps that will relocate the user if he or she navigates elsewhere. I found some old solutions to this problem for like ios 7 or 8 which no longer worked in ios 9. This is what I tried @IBAction func locateMe(sender: AnyObject) { self.mapView.setUserTrackingMode(MKUserTrackingMode, animated: true) } there are no errors before I try to run it but when I do it says: editor placeholder in source file 回答1: I didn't solve the bug issue, But i did realize how

How do you customize the border of a UISegmentedControl in swift

♀尐吖头ヾ 提交于 2019-12-13 08:14:31
问题 I'm trying to make make the top border of a UI segmented control one color and the bottom border of a UISegmented control another color. I can do it with a UIView, but it doesn't work correctly with a segmented control for some reason. 回答1: I suggest you to use custom divider images. Please refer either to "Customizing appearance of UISegmentedControl" article or "UIKit User Interface Catalog" topic. 来源: https://stackoverflow.com/questions/33403841/how-do-you-customize-the-border-of-a

Alamofire not working in xcode 7

本小妞迷上赌 提交于 2019-12-13 07:38:02
问题 I am not getting any sort of error when puthing the import statement at the top of the file. Alamofire, from what I can tell, is recognized by xcode. It is when I try and access code from Alamofire when I run into problems. When I begin to type Alamo, the only auto complete I code I can use is "Alamofireversionnumber" and nothing more. For clarification I am using xcode 7 and swift 2. 来源: https://stackoverflow.com/questions/33685768/alamofire-not-working-in-xcode-7