Swift Xcode debug auto complete - xcode

I have been porting an app from Objective C to Swift. In Objective C I get autocomplete in the Xcode debug pane as shown. However, the Swift version does not. I may be missing something simple but after working around this for a few months I give up. Attached are relevant screenshots (top is Objective C).
I realize this may not be a language specific feature but how do you get debug autocomplete functionality in Swift like Objective C?

Try the control+Space combination forcefully at locations. Sometimes it helps.
There's also this link I found. maybe it could help:
XCode 6 isn't autocompleting in swift

Answer is late, but I want to see my answer more people for this situation.
This is not Xcode Problem. Erasing Derived data is just temporary work.
I guess you are included by one of them
Your application is support Above iOS 7 (not iOS 8)
Use Cocoapod or 3rd party app
Autocomplete is not working when you develop with swift above iOS7. Swift did't recommend to use static lib, but iOS7 support only static lib not dynamic lib.
(see this post https://blog.cocoapods.org/CocoaPods-0.36/,
http://corinnekrych.blogspot.kr/2015/04/how-well-does-swift-plays-on-ios7.html)
Change your project to iOS 8
Cocoapod will need use_frameworks! if you want to support dynamic lib.
If you use dynamic link, You don't have to write header in Bridge_header. Import it in Swift file like Import UIKit
One more trick is just clean your Project will make Swift Auto complete, but after rebuild, you can't use auto complete.

Related

How to implement Steamworks API into an existing macOS / Xcode project?

I intend to submit an existing macOS game to Steam. It was made with Xcode using Objective-C and Swift.
According to the Steamworks documentation I need to link libsteam_api.dylib in the Xcode project.
However this does not seem to be enough. Several specific build and target settings need to be made, of which I can find no documentation. Also several other conditions need to be met, such as init calls that should be made.
The non-C++ language support page unfortunately has no information about Objective-C / Swift / Xcode and searching the web does not return any useful information other than how to code sign Mac games for Steam.
Is there any tutorial / help / step by step guide on how to do make the game submittable to Steam?
You can use Objective-C++ for easy integrate SteamWorks API to your Xcode project.
SteamWorks SDK has example named "steamworksexample" that show how to use it.

GPUImage won't compile on iOS 12

I have these errors:
Cocoa.h File Not Found (in GPUImageView.h)
Unknown Type Name: **NSOpenGLContext, CVOpenGLESTextureCacheRef (GPUImageContext)
Now, I tried to fix all these errors, but ended up making things worse.
I know OpenGL ES is deprecated in iOS 12, but as I understand deprecation, it should still be working for the moment, right?
For error #1, I don't understand what's a MAC OS framework (cocoa.h) doing in here (some of the references are not surrounded with #IFDEF MAC_OS statements).
As for error #2, these types are defined within the AppKit framework (also a MAC_OS framework, not an iOS framework).
I have considered switching to GPUImage2, but it's a ton of work as it's not as easy as swapping the frameworks, I'll have a lot of code to rewrite. I also see Brad Larson (the semi-God behind this framework) has already started working on GPUImage3 which will use Metal instead of OpenGL ES but it's still work-in-progress but it won't be a simple swap from GPUImage v1 to GPUImage v3.
I found a way to fix it. Maybe it will help someone with the same problem. The GPUImage main folder contains the iOS and the MAC projects.
Go to the framework folder, and delete the GPUImageMac.xcodeproj file.
Then go to the Source folder located within the framework folder, and delete the whole folder named Mac.
Clean your project and rebuild. Voilà!
Good luck!

Can I uses swift library on iPad Playground?

I'm trying to uses swift playground on iPad.
It supports all of iOS classes.
But I can't find this features
How can I import GitHub library?
How can I create multiple Swift files?
Anyone know about this?
You can do this one of two ways.
Do it on GitHub and then download Working Copy. It's a free iOS app that allows you to download projects from GitHub as .playground files and run them in Swift Playgrounds.
Do it on a Mac. I understand this might not be possible, but it is by far the best method of doing this. It is much easier and, as a whole, better. For the best experience, I recommend this option.

Applovin tvOS LIbrary Issues

I apologize but I am new to tvOS development, an programming in general.
IDE: Xcode 7.2.1
language: Swift 2
platform: tvOS
I am currently trying to integrate the AppLovin SDK for my tvOS app.
I have followed the documentation and have everything set up for Swift.
However, there is one glaring problem. when downloading the SDK the static library File: libAppLovinTVOS.a does not populate as a library.But rather a generic Document file.
I have downloaded it a couple times to see if it was just an error in downloading. Even tried to go to their gitHub to no avail. Any help will be deeply appreciated.
(sorry for breaking up the text it helps with my dyslexia)
when downloading the SDK the static library File: libAppLovinTVOS.a does not populate as a library.But rather a generic Document file.
There's nothing wrong. The file is a static library, not a framework, and it's completely normal for those to appear as plain old document files. I've got several similar libraries in my iOS project right now and they have exactly the same generic icon.

Error importing framework in Playground

I’m following the instructions for Importing Custom Frameworks into Playground, but I still keep getting "No such module” error.
I have tried adding everything in the workspace; a project with just Framework target, project of Cocoa Application with the framework, and just the Framework. I also tried creating a playground in the Application where I imported the framework, I can even import it in other swift file without any problem; but I can’t seem to be able to import it in playground.
Can someone please tell me what I might be doing wrong?
Try building your framework target using a simulator! I had only built mine using the generic device which doesn't work for playgrounds!
Did you ever get it to work? I figured out my issue. The code I was trying to import wasn't in a Framework Target. I had to add a new target to my project of type Cocoa Framework. Then include my source files in that framework, and then finally build that target. Then it worked.
I would like to echo what Reid said:
Try building your framework target using a simulator! I had only built mine using the generic device which doesn't work for playgrounds!
If you've updated to Xcode 12, you also need to make the "Build Active Scheme" box is checked. Select your playground and go to the inspector. The checkbox will be under "Playground Settings"
I've spent for this more than 4 hours. But i've solved it for XCode 10.
You're unable to add any framework into the Playground if there's no target for it the Workspace where the Playground is. So as you using downloaded framework (so am i) — you're doomed to fail with it.
The workable manual could be found here (God bless this guy): https://www.pardel.dev/blog/3rd-party-frameworks-in-xcode-playgrounds
tldr: the easiest way is to:
Download 3rd party framework sources.
Open *.xcodeproj
Add Playground to the Project.
Build project for any iOS simulator by cmd+b (have no idea how to use any macOS frameworks yet).
And it should work (at least it does for me).
I solved my problem with a different solution than Michael Welch's. I had my Xcode derived data setting different than original. Go to Preferences > Locations > Derived Data > Advanced and select Unique. This solved the framework not appearing in playground problem for me.

Resources