Not able to import main app module in xctest - swift

When using XCTest I am not able to import the main module. Instead of like importing #testable import App it is import #testable import Pods_App, also not able to import the main app structs and data. How to resolve this issue?

Click on your test file, then press CMD + OPTION + 0. This will bring up the inspector panel on the right side of the screen. Look for the target membership section inside the panel and ensure that the your test module is checked.

Related

How to click the menu item from the application using pywinauto

import pywinauto,time
from pywinauto import Application
from pywinauto.keyboard import send_keys
from pywinauto.controls.win32_controls import ButtonWrapper
from pywinauto import mouse
app = Application().start(cmd_line="C:\\Users\\6141\\Desktop\\eval\\32bit\\ProSeriesLauncher.exe")
time.sleep(20)
pywinauto.mouse.click(button="left",coords=(1275,270))
time.sleep(20)
app.ProSeriesLauncher.MenuSelect("File->Open Client").click()
**Error occurs:**
pywinauto.findbestmatch.MatchError: Could not find 'ProSeriesLauncher' in 'dict_keys([])'
This application has a menu "file" where there is Open Client I need to open by click. Is there any method Application name: ProSeries Basic.

How to create a global import to use in all the app?

I would like to find a way to import a pods / library once and not into all the classes in my app
Use this above the app delegate class or anywhere but it is better to put it above app delegate class.
#_exported import LibraryName

No such module Error "NotificationCenter" WatchOS, Swift

I'm getting an module error in two of my controllers who tries to import the NotificationCenter framework. I have added the framework in "linked frameworks and libraries" but I'm still getting the error.
I even tried cmd + shift + k, but it did not do any good for me.
I also tried to set the framework search path to $(SRCROOT), but still same error.
I have two controllers with the import.
Linked frameworks and libraries
Added notificationCenter
TimeController
import WatchKit
import Foundation
import NotificationCenter error: "No such module 'NotificationCenter'"
SwipeController
import WatchKit
import Foundation
import NotificationCenter error: "No such module 'NotificationCenter'"
Any help would be much appreciated!
I agree with #David's comment, There are three targets for a single watchOS project.
You need to try these steps for each Target:
Select each target and go to -> Build Phases
Click on the right arrow. and click on the +
Finally, search for NotificationCenter and add the framework.
You need to try these steps for each target.

UIGestureRecognizer setState: in swift 3 [duplicate]

You can't write to self.state in the subclass unless you import UIGestureRecognizerSubclass.h as indicated here.
In a Swift environment, I'm confused how I'd go about importing this. I tried import UIGestureRecognizerSubclass.h, and without the .h, but I still can't write to self.state.
How would I accomplish this?
The Swift equivalent is simply:
import UIKit.UIGestureRecognizerSubclass
That imports the appropriate header.
You need to have or create a -Bridging-Header.h file to import objc headers such as the one you want. The import line looks like this:
#import <UIKit/UIGestureRecognizerSubclass.h>
If you don't already have a bridge header file in your app, the easiest way to get one is to add an objc class to your project, and xcode will ask if you want one, then creates the file and ties it into the settings for you. You can then delete the objc class.
Everything in that header file is automatically made available to your Swift code, no need to add any import lines in your swift files.

Why my import MessageUI in AppDelegate is not visible within my UITableViewController?

Since Swift files are visible for each others, why my import within Appelegate is not visible for one of my controllers? I get an error there.
This is called Access level for Swift Modules. Default access level for Swift modules is internal, that is to that file itself.
Have a look here in Apple documentation Access level in Swift module
You need to import frameworks/modules in which ever class you are using.
Put import MessageUI at the top of the file where you declare your PBOUserViewController class (which I hope is contained in a separate .swift file than your AppDelegate).