swift2

AVPlayerViewController play/pause issue in iOS

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 07:37:44
问题 I am working on the iOS application. This application base on the NEWS media. I am playing the small video of highlighted News. I am facing a stranger problem with AVPlayerViewController . When i play the video everything is fine. When i go to offline the buffer video play perfect & after the play buffer video, the video stops but the progress bar(Slider) continuously in play state while the video has been stopped. For more clearance please watch this GIF image : Please visit this link for

How to load rtf using url instead of local

别说谁变了你拦得住时间么 提交于 2019-12-13 07:28:03
问题 I have code to load local rtf files in textview but how to do i make it works for files located online Since it does not works when i use url Here is url - http://howtotechworld.com/rtfdoc.rtf Here is code if let rtf = NSBundle.mainBundle().URLForResource("http://howtotechworld.com/rtfdoc", withExtension: "rtf", subdirectory: nil, localization: nil) { do { let attributedString = try NSAttributedString(fileURL: rtf, options: [NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType],

Realm file size is too large

拥有回忆 提交于 2019-12-13 07:17:51
问题 I'm trying to integrate Realm into my project and noticed an issue. I've seen other posts on this, but they were a little over a year ago and have been resolved.. When adding objects to Realm, things are file. But when removing objects, they get removed from the DB, but the file size is still large. If I open the realm file in TextEdit, I can see raw text of old records. Why aren't they getting fully deleted? Take a look at this screenshot. Zero files in the Realm DB, but the file size is 23

How to decrease constantly time interval in an ImageView animation

不想你离开。 提交于 2019-12-13 07:08:20
问题 I need to reduce constantly the time interval in an ImageView animation. I have a button to start it and then let's say I want to decrease the time interval pushing another button, how can I do it? When I press the first button I have to set the time interval and then it is constant, but I need to change it. Can you help me? 来源: https://stackoverflow.com/questions/38238667/how-to-decrease-constantly-time-interval-in-an-imageview-animation

Reloading view controller when navigation bar back button is pressed in swift 2

限于喜欢 提交于 2019-12-13 06:49:44
问题 I have three view controllers which in the third one I have a picker view which it store data into core data, and when I press navigation bar back button I want second view controller to refresh it's labels from core data, but I don't know how Any suggestion ? 回答1: Use NSFetchRequest() method in viewWillAppear() method in second view controller 来源: https://stackoverflow.com/questions/35578699/reloading-view-controller-when-navigation-bar-back-button-is-pressed-in-swift-2

How to create a Type-Safe custom function in SQLite.swift?

≯℡__Kan透↙ 提交于 2019-12-13 06:08:47
问题 I would like to create a simple distance function to order objects while fetched from a SQLite database in Swift2. I’m using the awesome SQLite.swift framework. With the following I could fetch the nearest objects: db.createFunction("distance") { (args) -> Binding? in assert(args.count == 4) if let lat1 = args[0] as? Double, let lon1 = args[1] as? Double, let lat2 = args[2] as? Double, let lon2 = args[3] as? Double { let deltaLat = lat1 - lat2 let deltaLon = lon1 - lon2 return deltaLat *

Swift: NSCountedSet with Map

ⅰ亾dé卋堺 提交于 2019-12-13 05:33:06
问题 I would prefer to use Person Struct , but I since it does not confirm to AnyObject , I can't use it with NSCountedSet class Person: AnyObject { var name: String = "" var age: Int = 0 var score: Int = 0 } let personA = Person() personA.name = "john" let personB = Person() personB.name = "larry" let personC = Person() personC.name = "jack" let personD = Person() personD.name = "bob" var people:[AnyObject] = [personD, personC, personA, personB, personC, personA, personC, personD, personD] let

Swift2 reflection help. Convert the value I get (type Any?) to Bool or Bool? accordingly

怎甘沉沦 提交于 2019-12-13 04:52:55
问题 for a unit test of mine, I wrote a small helper that can get me a property Value by name. let m = Mirror(reflecting: self) let child1 = m.descendant(name) now the problem is that the child has Type Any? but the properties real type is e.g. Bool? So Any is actually an Optional! Thats why if child1 is Bool? never fires because Any? isn't the Bool?. But child1! is Bool? doesn't compile. And child1! is Bool isn't true! So how do I 'unbox' this reflected Any? value? a small example of what I mean

Gmail API iOS in Xcode 7, Swift 2

浪子不回头ぞ 提交于 2019-12-13 04:12:05
问题 I am following Google's tutorial https://developers.google.com/gmail/api/quickstart/ios?ver=swift to create a simple Swift project but compiler throws below error. Is this due to some changes in Xcode 7,Swift 2 ? Any idea how to fix it Undefined symbols for architecture arm64: "_OBJC_METACLASS_$_GTLService", referenced from: _OBJC_METACLASS_$_GTLServiceGmail in GTLGmail_Sources.o (maybe you meant: _OBJC_METACLASS_$_GTLServiceGmail) "_OBJC_CLASS_$_GTMOAuth2ViewControllerTouch", referenced from

Calling UITextView() takes 5.8 second in keyboard extension with Swift 2?

痴心易碎 提交于 2019-12-13 03:37:54
问题 I just updated my XCode form 6.3 to 7.1 and thus also my project from Swift 1.2 to Swift 2. Everyting seems to work except my app starts some 6 seconds slower then it used to. I tracked the problem to this class initializer: class TextPreviewAdapter { private let themeProvider: ThemeProvider private let containerView: UIView private let previewText: UITextView private let carretView: UIView private var carretTextPosition: UITextPosition? init(themeProvider: ThemeProvider) { self.themeProvider