swift3

Swift 3 - Pass struct by reference via UnsafeMutableRawPointer?

房东的猫 提交于 2020-01-04 07:51:02
问题 In the Core Audio -Framework user data can be passed into callbacks via an UnsafeMutableRawPointer? . I was wondering how to pass a struct by reference via this UnsafeMutableRawPointer? . Changes made inside the callback should be reflected outside the callback. I set up a playground to test this: struct TestStruct { var prop1: UInt32 var prop2: Float64 var prop3: Bool } func printTestStruct(prefix: String, data: TestStruct) { print("\(prefix): prop1: \(data.prop1), prop2: \(data.prop2),

Create Custom IBAction in Controller of my Custom View

感情迁移 提交于 2020-01-04 07:09:22
问题 firstly I cannot post any Code but I´ll try to describe my problem as best as I can. Ok. I created a Custom Swift View File as view.xib and loading it in my view.swift I loaded that Xib . The Xib is a simple label above a imageview . I can create my IBOutlet in my view.swift file and e.g. switch the image or change the label. view.swift simply extends UIView . So now I integrated this view in my Storyboard which has a Controller (lets call it otherVC.swift ). Now otherVC.swift wants to get

Apple Mach-O Linker Error (static, not ld)

拈花ヽ惹草 提交于 2020-01-04 06:45:16
问题 I have recently encountered the Apple Mach-O Linker Error. Most guides suggest to change bitcode in Build Settings to "No", however it only applies to the ld error, which is different from mine. I will provide a screenshot, please help to fix the bug. The pod HandySwift is causing the bugs to appear. Here is the Github code source for it. https://github.com/Flinesoft/HandySwift It is from the CSV Importer pod on Cocoapods. https://cocoapods.org/pods/CSVImporter Click here to look at the

Seamless looping Video using AVPlayer- Swift

混江龙づ霸主 提交于 2020-01-04 06:34:14
问题 I am using AVPlayer to play local video in background using loop and video is playing fine but after finishing video it takes pause to play video in loop. I have tried many methods and also seen many post on stack overflow but i failed to find appropriate solution. I am using Swift3. Code is here : var videoplayer :AVPlayer = AVPlayer() override func viewDidLoad() { super.viewDidLoad() let path = Bundle.main.path(forResource: "background4", ofType: "mp4") videoplayer = AVPlayer(url: URL

Weird escaping function behavior after updating to Swift 3

半世苍凉 提交于 2020-01-04 06:22:12
问题 I'm having difficulties with the following lines of code after updating to Swift 3: private var functionHandlers = [(() -> Int) -> ()]() private var myFunction: (() -> Int)? func doRegister() { functionHandlers.append { (f: (() -> Int)) in myFunction = f } } That gave me the compiler error: Assigning non-escaping parameter 'f' to an escaping closure So then, I tried this: func doRegister() { functionHandlers.append { (f: @escaping (() -> Int)) in myFunction = f } } and this: func doRegister()

#selector' refers to a method that is not exposed to Objective-C swift 3

笑着哭i 提交于 2020-01-04 05:42:09
问题 I'm using Xcode 8 and swift 3. I have the following error on line "let action": #selector' refers to a method that is not exposed to Objective-C Any suggestion ? override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cellWaze", for: indexPath) as! WazeTableViewCell // Configure the cell... cell.lbAgence.text = aWAgence[indexPath.row][0] as? String let cellLat :Double = aWAgence

Swift 3 photo capturing

此生再无相见时 提交于 2020-01-04 04:26:07
问题 I'm using this piece of code: func capturePhoto(blockCompletion: @escaping blockCompletionCapturePhoto) { guard let connectionVideo = self.stillCameraOutput.connection(withMediaType: AVMediaTypeVideo) else { blockCompletion(nil, nil) return } connectionVideo.videoOrientation = AVCaptureVideoOrientation.orientationFromUIDeviceOrientation(orientation: UIDevice.current.orientation) self.stillCameraOutput.captureStillImageAsynchronouslyFromConnection(connectionVideo) { (sampleBuffer:

How to save a uiimageview on top of another uiimageview (swift3)

跟風遠走 提交于 2020-01-04 04:19:29
问题 Right Now I have two image views. All the button does is save the photo with the red box over the blue box and it will save image2 in the blue box and image1 in the red box. I would like red box to be saved over the blue box in just the small bottom right section of the blue box. Just like a lower third you see on tv ]] import UIKit class ViewController: UIViewController { var image1 = UIImage(named: "f.jpg") var image2 = UIImage(named: "l.jpg") override func viewDidLoad() { super.viewDidLoad

In Swift3, KVO the alpha of a UIView?

放肆的年华 提交于 2020-01-04 03:32:27
问题 It's "easy" to KVO a value in Swift3, using the technique in this great post... https://stackoverflow.com/a/25219216/294884 How do I KVO the alpha of a UIView? Goal: imagine a screen with a small view V. Screen has a large table view. Each cell has a small view CV. I want each CV to follow 1 the alpha of V, actually during an animation of the alpha of V. (The only real alternate I can think of is to CADisplayLink the cells and poll the alpha of V, which kind of sucks.) 1 Reason for that? It's

Gitlab - Google compute engine Continuous delivery

走远了吗. 提交于 2020-01-04 02:08:22
问题 What I am trying to do is to enable Continuous delivery from GitLab to my compute engine on Google Cloude. I have Ubuntu 16.04 TSL running over there. I did install all components needed to run my project like: Swift, vapor, nginx. I have manage to install Gitlab runner as well and created a runner whcihc is accessible from my gitlab repo. Everytime I do push on master the runner triggers. What happen is a failure due to: could not create leading directories of '/home/gitlab-runner/builds