0

I am trying to add 2 swift files to my Xcode project. They are located on my desktop currently. When I open them up, they look like this:

Regular file

However, when I add them to my Xcode project, they look like this:

Imported file

How can I add these files without the text messing up? Thanks!

1 Answer 1

2

That looks suspiciously like some kind of PNG file, not a text file. ("PNG" followed by "IHDR", specifically.) Are you sure that's a Swift file and not a screenshot of a Swift file or something?

That's also a very strange title in the titlebar of your screenshot. Perhaps that is related.

Either way, seems pretty clear that these allegedly Swift files are actually some format which is not plain text. Copy the text out of it into a new file created from scratch by Xcode, and that will fix whatever the problem is.

Sign up to request clarification or add additional context in comments.

1 Comment

No it is a .Swift file. I covered the titlebar up when editing the screenshot. I had already copied the text out and pasted it into another file, but I was hoping there was a quicker solution. I believe this is the correct answer then. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.