I have an app that can view a PDF that is already stored within the project. I want to be able to create a new PDF document and store it in the app directory to later view in the already existing viewer. The PDF would be created from an array var todoList: [String] = [] that is displayed on a UITableView. I know to create a PDF, I have to create a file name, path, and directory. I don't know how to do this. I saw online reference to URL and URL request, but I'm not sure if this is the correct avenue for what I want to do. Can someone please give me some advice and guidance? Everything I can find is for Objective-C. Thank you. Sorry if this is not in the right format, I'm new to this forum.
What's wrong with the Objective-C material? If the Objective-C material does what you need, translating it to Swift is going to be easier than figuring out how to do things from scratch with Swift.
The main technology to look at for creating PDFs programatically is Quartz. Apple's documentation includes the Quartz 2D Programming Guide, which has a section on creating PDFs. Take a look at the CGPDFContext series of functions. There's a Quartz2D forum here in the Graphics and Games section that you can use to ask questions on PDF creation.
Another techonology that can help you with PDF creation is Core Text. Core Text has a function, CTFramesetterSuggestFrameSizeWithConstraints, that makes it easy to figure out how much of a string can fit on a page. You don't have to use Core Text to create PDFs, but using it can simplify creating large PDF files with lots of pages of text.
Creating an NSURL object for the PDF file can also help. You can pass the NSURL object to the function CGPDFContextCreateWithURL to create the PDF context. After creating the PDF you can pass the NSURL object to the PDF view to display the PDF. Take a look at the NSURL class reference to learn more about creating NSURL objects.