Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am a Swift and Xcode beginner, and I have read Apple's "The Swift Programming Language" and understand the fundamentals of Swift quite well. But when I try to refer to the documentation to know what functions to call, etc to do something not often done (such as using Replay Kit) I run into trouble trying to use it. I've tried using code exactly as specified in Apple's "Documentation and API Reference" but the code doesn't execute properly or even at all. For example, using the exact functions specified here: [https://developer.apple.com/reference/replaykit/rpscreenrecorder] doesn't do anything at all.

import UIKit
import ReplayKit

class ViewController: UIViewController, RPPreviewViewControllerDelegate {
    

    @IBAction func startRecording(_ sender: Any) {
        
        func startRecording(handler: ((Error?) -> Void)? = nil){
           
        }

    }
    

    @IBAction func stopRecording(_ sender: Any) {
        
        func stopRecording(handler: ((RPPreviewViewController?, Error?) -> Void)? = nil){
            
        }
    }
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
     
    }


}


What I have tried:

Pasting relevant code in Xcode from the documentation
Posted
Updated 14-Mar-17 16:06pm
v6
Comments
[no name] 14-Mar-17 19:07pm    
"Can anyone help me understand", probably not. We can't teach you programming over the internet.
Garth J Lancaster 14-Mar-17 19:42pm    
why don't you use Improve question to update your question and provide a meaningful example of what (an) issue is ? - I personally wouldn't look at API documentation expecting it will teach me how to program - it would show you the bits & pieces you can use, but not how to put them together. For 'how to actually program' in SWIFT for example, I'd check out Ray Wenderlich's site https://www.raywenderlich.com/ that has Swift tutorials, and/or Paul Hudson's excellent & cheap books https://www.hackingwithswift.com/
Code Different 14-Mar-17 21:07pm    
I have read Apple's "The Swift Programming Language" and understand the fundamentals of Swift quite well. But when I try to refer to the documentation to know what functions to call, etc to do something not often done (such as using Replay Kit) I run into trouble trying to use it. I've updated my question with a much better explanation and a code example. Thanks!
Graeme_Grant 14-Mar-17 21:07pm    
there are plenty of good books for getting started with Swift: [^] and YouTube videos: getting started swift - YouTube[^]
Patrice T 14-Mar-17 22:14pm    
Search a forum for swift programmers, you will be with people sharing same problems.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900