swift3

Dereference UnsafeMutablePointer<UnsafeMutableRawPointer>

天大地大妈咪最大 提交于 2020-02-05 08:45:49
问题 I have a block that is passing data in that I'd like to convert to an array of array of floats -- e.g. [[0.1,0.2,0.3, 1.0], [0.3, 0.4, 0.5, 1.0], [0.5, 0.6, 0.7, 1.0]]. This data is passed to me in the form of data:UnsafeMutablePointer<UnsafeMutableRawPointer> (The inner arrays are RGBA values) fwiw -- the block parameters are from SCNParticleEventBlock How can I dereference data into a [[Float]]? Once I have the array containing the inner arrays, I can reference the inner array (colorArray)

Dereference UnsafeMutablePointer<UnsafeMutableRawPointer>

大城市里の小女人 提交于 2020-02-05 08:44:25
问题 I have a block that is passing data in that I'd like to convert to an array of array of floats -- e.g. [[0.1,0.2,0.3, 1.0], [0.3, 0.4, 0.5, 1.0], [0.5, 0.6, 0.7, 1.0]]. This data is passed to me in the form of data:UnsafeMutablePointer<UnsafeMutableRawPointer> (The inner arrays are RGBA values) fwiw -- the block parameters are from SCNParticleEventBlock How can I dereference data into a [[Float]]? Once I have the array containing the inner arrays, I can reference the inner array (colorArray)

Calculate Height Of NSAttributedString Containing HTML

限于喜欢 提交于 2020-02-05 05:31:04
问题 I am using NSAttributedString to display HTML text using the following code. do { let html = "<span style=\"font-family: Montserrat-ExtraLight; font-size: 14; line-height: 1.5;\">\(clinic.profile!)</span>" let clinicProfile = try NSAttributedString( data: (html.data(using: String.Encoding.unicode, allowLossyConversion: true)!), options: [ NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType ], documentAttributes: nil ) contentView.attributedText = clinicProfile scrollView.addSubview

Why alamofire downloads progress in alert will flashing and the behind screen starts to be fade to black?

喜你入骨 提交于 2020-02-05 04:55:05
问题 I have progress view in alert when downloading with alamofire, but the problem is that when I want to download the progress view in alert will start to be complete but flashing and the other problem is that the behind screen will start to be fade to black I think in every second a new alert with progress view will show and at the end there are lots of alerts how can I avoid them? downloadTimer = Timer.scheduledTimer(timeInterval: 1 , target: self, selector: #selector(flashingDownload),

Cannot invoke 'append' with an argument list of type '(String, withName: String)' in Alamofire 4.0

蹲街弑〆低调 提交于 2020-02-04 01:35:38
问题 I'm using Alamofire 4.0 to upload video to server after select or record it through device/camera but when I'm trying to call upload function with append , this error appeared to me in all append statement , what is the wrong in my code. the second my question about if I want to display progress with percentage of progress during upload how I can make that through Alamofire. Thanks :) My code after reading url of selected/recorded video func imagePickerController(_ picker:

Cannot invoke 'append' with an argument list of type '(String, withName: String)' in Alamofire 4.0

霸气de小男生 提交于 2020-02-04 01:35:27
问题 I'm using Alamofire 4.0 to upload video to server after select or record it through device/camera but when I'm trying to call upload function with append , this error appeared to me in all append statement , what is the wrong in my code. the second my question about if I want to display progress with percentage of progress during upload how I can make that through Alamofire. Thanks :) My code after reading url of selected/recorded video func imagePickerController(_ picker:

How to properly implement a static cell with Swift 3

纵饮孤独 提交于 2020-01-31 15:11:29
问题 I literally could not find a single tutorial that showed me how to build an app that uses static cells; with clickable cells. Based on few out dated posted and object-c answers, I've put something together. My issue is, when I click on a cell, I get staticDemoTableCell is has no member present . I have embedded a Table Controller in my UIViewController. For that cell (only one so far), I've created a class: class staticDemoTableCell: UITableViewCell, UITableViewDelegate { @IBOutlet weak var

swift3 webview with post request

自古美人都是妖i 提交于 2020-01-31 05:52:24
问题 I am running a school project and I am new from swift3. By searching, I know how to pass a data from one view to anther: Passing data from a tableview to webview In the post above, he is using http get request to pass data to website, then reload the webivew: let URL = NSURL(string: "https://www.example.com?data=\(passData)") webView.loadRequest(NSURLRequest(url: URL! as URL) as URLRequest) I see some useful links like about code with http post request in here: HTTP Request in Swift with POST

How to get the 'n' weekday of a Date

不羁岁月 提交于 2020-01-30 11:48:11
问题 I need to translate this function into swift. Basically what does it get the 'n' day of the current week. So for example if i use it with NSDate().getWeekDay(0) it gives me Sun 11 Sept, and so on. But seems rangeOfUnit no longer exists in Swift-3. This was my previous implementation in Swift-2 extension NSDate { func getWeekDay(day: Int) -> NSDate { var beginningOfWeek: NSDate? NSCalendar.currentCalendar().rangeOfUnit(NSCalendarUnit.WeekOfYear, startDate: &beginningOfWeek, interval: nil,

How to get the 'n' weekday of a Date

时光总嘲笑我的痴心妄想 提交于 2020-01-30 11:47:25
问题 I need to translate this function into swift. Basically what does it get the 'n' day of the current week. So for example if i use it with NSDate().getWeekDay(0) it gives me Sun 11 Sept, and so on. But seems rangeOfUnit no longer exists in Swift-3. This was my previous implementation in Swift-2 extension NSDate { func getWeekDay(day: Int) -> NSDate { var beginningOfWeek: NSDate? NSCalendar.currentCalendar().rangeOfUnit(NSCalendarUnit.WeekOfYear, startDate: &beginningOfWeek, interval: nil,