I have two targets app
and appTests
. Also I have class Wine
and framework Realm
and 'RealmSwift' which are linked to those two targets. There is no exception When I use class Wine
in traget app
.
But when I want to run test like
appTests.swift (22 lines)
import UIKit
import XCTest
import RealmSwift
class appTests: XCTestCase {
func testRealmAdd() {
NSFileManager.defaultManager().removeItemAtPath(Realm.defaultPath, error: nil)
let realm = Realm()
let wine = Wine() // when error occure
wine.photo = "photo"
wine.desc = "description"
wine.raiting = 3.0
realm.write { () -> Void in
realm.add(wine)
}
let result = realm.objects(Wine)
print("\(result)")
XCTAssertTrue(result.count == 1, "There should be one element")
}
}
Wine.swift (10 lines)
import UIKit
import RealmSwift
class Wine: Object {
dynamic var desc: String = ""
dynamic var photo: String = ""
dynamic var raiting: Double = 0
}
Then an exception appear at line 8 in appTests.swift
RLMObject subclasses with the same name cannot be included twice in the same target. Please make sure 'Wine' is only linked once to your current target.
I already did clear DerivedData and project. Could You suggest where I should look?
EDIT after nhgrif comment
Ok it appears that an exception is rising earlier, in line 7. Which is now marked in code thanks to nhgrif.
A Target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.
You can access Target Membership by selecting file and opening the right menu in Xcode (the menu is called Inspectors ). Then, in File Inspector at the bottom of the menu, find Target Membership . It's very important to check all files in your project because without this you won't be able to build a new app target.
A target defines a single product; it organizes the inputs into the build system—the source files and instructions for processing those source files—required to build that product. Projects can contain one or more targets, each of which produces one product.
Overview. Each target contains a set of source files that Swift Package Manager compiles into a module or test suite. You can vend targets to other packages by defining products that include the targets. A target may depend on other targets within the same package and on products vended by the package's dependencies.
Select the element which has an ID of header and also a class name of callout. The big point here is that you can target elements that have combinations of classes and IDs by stringing those selectors together without spaces.
Thank you for sharing that you are in job-search mode and targeting two various job types. This is a viable approach in today’s competitive environment. Plus, it’s great to have two areas of passion. In terms of LinkedIn, I do not recommend two different profiles.
The second targets the same element, but overrides the color, instead of having to use: or perhaps prefacing the selector with something even more specific. More useful is multiple classes and using them in the “object oriented” css style that is all the rage lately.
If the same person views my LinkedIn several times in a day, will I know? Yes, if it’s not an immediate reload of a page. I’ve had many people view my profile twice in the same day and it shows up as two separate notifications. How many profile views does the average LinkedIn user get in a day? I write 1-2 posts per week. I engage people often.
Wine.swift
should only be in app
, and not appTests
. Including it in both results in appTests
having two classes named Wine
(app.Wine
and appTests.Wine
), which is not something that Realm supports. As long as Wine
is public
(or in Swift 2.0, @Testable
), you can access it from appTests
without including it in the appTests
target because appTests
links in app
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With