Search results for

“SwiftData inheritance relationship”

4,980 results found

Post

Replies

Boosts

Views

Activity

Ordered one-to-many relationships
Hi,I would like to address this issue (http://stackoverflow.com/questions/7385439/exception-thrown-in-nsorderedset-generated-accessors).The problem is that when I set a one-to-many relationship to be ordered in model definition, I receive a runtime exception.I did not find any topic here related to this issue, so I am creating one here.As you can see, this issue persists for many years in CoreData.
1
0
353
Sep ’15
Reply to How to implement and use a search-tokens object in Core Data?
Thanks for the response. This highlights why I should use strings and also leads me to the conclusion that a single entry per record is the way to proceed. Given that structure of the data I would just use predicates with the beginswith. A bit of research indicates that the Spotlight option supplies data to the system Spotlight service. I plan to implement the token insertion using the following existance check and usage. Later I will acces the token object as part of the search process. I am still hoping that someone who has implemented the use of search tokens can share their experience and point me in the right direction with specific pointers.For example ~ a possible solution:(And to begin with, I am not sure why Apple doesn't do this in their documentation)These are my initial thoughts on how this might work (I am in the process of figuring this out so caveat emptor)Create a simple tokens object containing one string attribute to hold a single wordThis word attribute becomes a search indexAdd a ToMany relationship
Sep ’15
Reply to Can someone explain contents in SUBQUERY?
While I wait for the link in the other post to be moderated... (If it doesn't show up, do a Google Search for What the heck is SUBQUERY? and read the Fun with Objective-C blog entry.)Should the property be allocated and initialized before the query is executed? How should it be populated? I'm concerned that you're misunderstanding how the expression works.A simple subquery looks like this: SUBQUERY( collection, $x, $x.property = 'foo' and $x.number = 42)That's the subquery expression for: the values from collection that each (individually) match property = 'foo' and number = 42.That syntax exists because ANY collection.property = 'foo' AND ANY collection.number = 42can be satisfied by two different members of collection. In contrast SUBQUERY( collection, $x, $x.property = 'foo' and $x.number = 42).@count > 0isn't true unless the same member of collection has 'foo' and 42 for its values.Subquery takes three arguments:1. An expression which evaluates to a collection of values2. A variable name that you're go
Sep ’15
Storyboard: Making Reference to Window Controller Property
I am making the transition from iOS development into OS X, but am having a bit of trouble understanding some of the relationships between NSWindowController, NSViewController, and how they work with Interface Builder.I have a NSSplitViewController subclass that has a variable for sidebar NSViewController. I don't see a way to make that connection as an IBOutlet in Interface Builder? Am I missing something?This is what I am doing thus far. If there's a better way, I'd love to learn.class PrimaryWindowController: NSWindowController { var splitViewController:PrimarySplitViewController! { didSet { splitViewController.persistenceController = persistenceController } } override func windowDidLoad() { super.windowDidLoad() if let split = contentViewController as? PrimarySplitViewController { splitViewController = split } } }Thanks for the assist.
Topic: UI Frameworks SubTopic: AppKit Tags:
0
0
253
Sep ’15
Reply to Cannot use class-only protocols as type parameters on swift
Have you considered just using protocols instead of class inheritance. Protocols have the advantage that you get flexibility to provide storage for the specific type while still supporting abstract usage.For example, you might try something like the following:protocol Department { var headCount : Int { get } } protocol DevDepartment : class, Department { var devLanguages : [String] { get } } protocol Employee { var department: Department? { get } } class Developer: Employee { var department : Department? { return devDepartment } weak var devDepartment : DevDepartment? }In this example, you only store the real department (DevDepartment) in this case, but you can still reference it via the department property when needed in the abstract sense and devDepartment when you really want to work with the employee as a Developer. You could throw a Developer instance into collections of both employees and developers.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Core Data and Relationships
I'm trying to start a dialogue with these comments where a clear description of core data relationships can be discussed.I've been building relational databases for more than three decades, and I find it interesting that every database development environment that uses relationships has a problem in writing a clear and decisive method of using the relationships.In Xcode, things are no different where the descriptions of setting up relationships requires a PhD to understand the content being discussed. The word used to describe the relationships are uniquely Apples approach in terms. for example; reflective relationships is used to describe(This entity can be the same as the entity at the source). Most database relationships use the term primary key, and foreign key. With the primary being the parent and the foreign key being the child relationship. In Apples description there is no reference to a parent or child relationship.What I'm trying to do
0
0
595
Sep ’15
Reply to Strange behaviour on segue
I'm getting this too but I haven't nailed down exactly what's responsible. In my case the segue works the first time I launch an app but freezes up on subsequent launches. Deleting the app clears it up for one more launch. Some notes:I'm using Objective-C only.I'm using storyboard references.I went through the Storyboards and made sure every view controller and non-relationship segue has an identifier.
Sep ’15
NSPredicate won't create where clause
I've tried all three of these statements, and all three give this error:Unable to generate where clause for predicate (matches2.bracket == <Brackets.Bracket: 0x7f9379c63f90> (entity: Bracket; id: 0xd000000000380000 <x-coredata:/ created = 2015-09-16 01:49:46 +0000; locations = <relationship fault: 0x7f9379956f50 'locations'>; matches = <relationship fault: 0x7f93799570a0 'matches'>; playoff = 0xd0000000034c0004 <x-coredata:/ secondPlayoff = nil;})) (unknown problem)These are the three predicates I tried, all with the exact same result:request.predicate = NSPredicate(format: matches2.bracket = %@, self) request.predicate = NSPredicate(format: %K.bracket = %@, matches2, self) request.predicate = NSPredicate(format: %K = %@, matches2.bracket, self)
3
0
484
Sep ’15
Reply to iOS system crash when clicking on NSUserActivity search item
First off, this came to my attention a few days ago and the test case is in the above link. Second, I'm having so much trouble getting small pesky issues resolved and deal with a ton of other stuff I need to do before I release my update for iOS 9, I really have, for lack of better wording, no energy to do it. I spent DAYS trying to figure out NSUserActivity and restoring states fiasco.I'm also surprised with the insistance from you guys to file bug reports. The issue is laid out here, copy it in to a report yourself. Or better yet, create a good relationship with developers so they are not exhausted with small issues and have time to file proper reports.I'm willing to write a report once I have finished dealing with my own issues. In the meantime, ill exclude supporting search.
Topic: App & System Services SubTopic: General Tags:
Sep ’15
Reply to wrapping C++ std::strings in Objective-C/C++
With your fixed codes, I can eliminate many minor possibilities. Thus I can definately say, what is bad with your code is:NSString *Caller = Caller; string Call = [Caller UTF8String]; NSString *Sector = Sector; string Sect = [Sector UTF8String]; NSString *OutPut = OutPut; string OP = [OutPut UTF8String];In Objective-C, outside of @interface ... @end or @implementation ... @end is under global context.You are declaring global variables which have no relationship with the parameters of your method `TestCPP:::::::::` .And the three NSString variables, they are initilized with non-initialized themselves.(I am a little astonished with seeing Clang compiles this sort of initializations with no warnings.)So, the variables are very probably NULLs, so method calls in Objective-C like [Caller UTF8String] generates NULLs. I believe you cannot initialize std::string with NULL.Moving the 6 lines to inside the `TestCPP:::::::::` method would work. But if your main concern is bridging between C++ and Swift, I recom
Topic: Programming Languages SubTopic: General Tags:
Sep ’15
Reply to Cannot use class-only protocols as type parameters on swift
This issue seems like a compiler bug to me. The behavior seems to be that you can use a protocol to satisify a Generic type unless there is a protocol constaint on that type in which case only a concrete type can satisfy it. The compiler seems (in this use case) to be treating a protocol inherited from a base protocol as not conforming to that base protocol. If you remove the type constraint then all is well. Why can't a protocol satisfy a type constraint if it inherits from the constraining protocol?Can someone remark whether this is really the intended behavior?
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to NSPredicate won't create where clause
What the error is stating is that the Core Data object you are trying to query does not have an attribute called bracket. I can see that you are attempting to access a faulted attribute called matches which probably has some additional bracket objects linked within but you will not be successful with this approach.Core Data just works a bit differently.If you want to test equality for a specific object then you might look at setting up the hash and isEqual functions for the custom object. However, even if you make that work you will find that performance degrades way beyond what you are expecting. You could also look at using the managedobjectid for the record and then querying those for a match. Again, your mileage may vary depending on how you plan to query this ~ equality queries are very expensive overall and with a lot of objects the performance will just shut down.I'd suggest you try creating a separate object that holds a single attribute value which can be search using a BEGINSWITH predicate. The sepa
Sep ’15
Ordered one-to-many relationships
Hi,I would like to address this issue (http://stackoverflow.com/questions/7385439/exception-thrown-in-nsorderedset-generated-accessors).The problem is that when I set a one-to-many relationship to be ordered in model definition, I receive a runtime exception.I did not find any topic here related to this issue, so I am creating one here.As you can see, this issue persists for many years in CoreData.
Replies
1
Boosts
0
Views
353
Activity
Sep ’15
Reply to App developer requires my apple ID username/password (with DDID) before sending demo app? is this standard practice?
Sounds like you don't have a trusting relationship to fall back on, so no...be afraid.
Replies
Boosts
Views
Activity
Sep ’15
Reply to How to implement and use a search-tokens object in Core Data?
Thanks for the response. This highlights why I should use strings and also leads me to the conclusion that a single entry per record is the way to proceed. Given that structure of the data I would just use predicates with the beginswith. A bit of research indicates that the Spotlight option supplies data to the system Spotlight service. I plan to implement the token insertion using the following existance check and usage. Later I will acces the token object as part of the search process. I am still hoping that someone who has implemented the use of search tokens can share their experience and point me in the right direction with specific pointers.For example ~ a possible solution:(And to begin with, I am not sure why Apple doesn't do this in their documentation)These are my initial thoughts on how this might work (I am in the process of figuring this out so caveat emptor)Create a simple tokens object containing one string attribute to hold a single wordThis word attribute becomes a search indexAdd a ToMany relationship
Replies
Boosts
Views
Activity
Sep ’15
Reply to Can someone explain contents in SUBQUERY?
While I wait for the link in the other post to be moderated... (If it doesn't show up, do a Google Search for What the heck is SUBQUERY? and read the Fun with Objective-C blog entry.)Should the property be allocated and initialized before the query is executed? How should it be populated? I'm concerned that you're misunderstanding how the expression works.A simple subquery looks like this: SUBQUERY( collection, $x, $x.property = 'foo' and $x.number = 42)That's the subquery expression for: the values from collection that each (individually) match property = 'foo' and number = 42.That syntax exists because ANY collection.property = 'foo' AND ANY collection.number = 42can be satisfied by two different members of collection. In contrast SUBQUERY( collection, $x, $x.property = 'foo' and $x.number = 42).@count > 0isn't true unless the same member of collection has 'foo' and 42 for its values.Subquery takes three arguments:1. An expression which evaluates to a collection of values2. A variable name that you're go
Replies
Boosts
Views
Activity
Sep ’15
Storyboard: Making Reference to Window Controller Property
I am making the transition from iOS development into OS X, but am having a bit of trouble understanding some of the relationships between NSWindowController, NSViewController, and how they work with Interface Builder.I have a NSSplitViewController subclass that has a variable for sidebar NSViewController. I don't see a way to make that connection as an IBOutlet in Interface Builder? Am I missing something?This is what I am doing thus far. If there's a better way, I'd love to learn.class PrimaryWindowController: NSWindowController { var splitViewController:PrimarySplitViewController! { didSet { splitViewController.persistenceController = persistenceController } } override func windowDidLoad() { super.windowDidLoad() if let split = contentViewController as? PrimarySplitViewController { splitViewController = split } } }Thanks for the assist.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
0
Boosts
0
Views
253
Activity
Sep ’15
Reply to Cannot use class-only protocols as type parameters on swift
Have you considered just using protocols instead of class inheritance. Protocols have the advantage that you get flexibility to provide storage for the specific type while still supporting abstract usage.For example, you might try something like the following:protocol Department { var headCount : Int { get } } protocol DevDepartment : class, Department { var devLanguages : [String] { get } } protocol Employee { var department: Department? { get } } class Developer: Employee { var department : Department? { return devDepartment } weak var devDepartment : DevDepartment? }In this example, you only store the real department (DevDepartment) in this case, but you can still reference it via the department property when needed in the abstract sense and devDepartment when you really want to work with the employee as a Developer. You could throw a Developer instance into collections of both employees and developers.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’15
Core Data and Relationships
I'm trying to start a dialogue with these comments where a clear description of core data relationships can be discussed.I've been building relational databases for more than three decades, and I find it interesting that every database development environment that uses relationships has a problem in writing a clear and decisive method of using the relationships.In Xcode, things are no different where the descriptions of setting up relationships requires a PhD to understand the content being discussed. The word used to describe the relationships are uniquely Apples approach in terms. for example; reflective relationships is used to describe(This entity can be the same as the entity at the source). Most database relationships use the term primary key, and foreign key. With the primary being the parent and the foreign key being the child relationship. In Apples description there is no reference to a parent or child relationship.What I'm trying to do
Replies
0
Boosts
0
Views
595
Activity
Sep ’15
Reply to NSFetchedResultsController SUBQUERY no such column
Anyone have any info on whether this is a bug on Apple's end or if you just aren't allowed to have a relationship in the collection definition portion of the subquery and it either isn't documented well or I missed it in the documentation?
Replies
Boosts
Views
Activity
Sep ’15
Reply to Strange behaviour on segue
I'm getting this too but I haven't nailed down exactly what's responsible. In my case the segue works the first time I launch an app but freezes up on subsequent launches. Deleting the app clears it up for one more launch. Some notes:I'm using Objective-C only.I'm using storyboard references.I went through the Storyboards and made sure every view controller and non-relationship segue has an identifier.
Replies
Boosts
Views
Activity
Sep ’15
NSPredicate won't create where clause
I've tried all three of these statements, and all three give this error:Unable to generate where clause for predicate (matches2.bracket == <Brackets.Bracket: 0x7f9379c63f90> (entity: Bracket; id: 0xd000000000380000 <x-coredata:/ created = 2015-09-16 01:49:46 +0000; locations = <relationship fault: 0x7f9379956f50 'locations'>; matches = <relationship fault: 0x7f93799570a0 'matches'>; playoff = 0xd0000000034c0004 <x-coredata:/ secondPlayoff = nil;})) (unknown problem)These are the three predicates I tried, all with the exact same result:request.predicate = NSPredicate(format: matches2.bracket = %@, self) request.predicate = NSPredicate(format: %K.bracket = %@, matches2, self) request.predicate = NSPredicate(format: %K = %@, matches2.bracket, self)
Replies
3
Boosts
0
Views
484
Activity
Sep ’15
Reply to iOS system crash when clicking on NSUserActivity search item
First off, this came to my attention a few days ago and the test case is in the above link. Second, I'm having so much trouble getting small pesky issues resolved and deal with a ton of other stuff I need to do before I release my update for iOS 9, I really have, for lack of better wording, no energy to do it. I spent DAYS trying to figure out NSUserActivity and restoring states fiasco.I'm also surprised with the insistance from you guys to file bug reports. The issue is laid out here, copy it in to a report yourself. Or better yet, create a good relationship with developers so they are not exhausted with small issues and have time to file proper reports.I'm willing to write a report once I have finished dealing with my own issues. In the meantime, ill exclude supporting search.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’15
Reply to Bug: A managed object relationship that contains multiple copies of the same object.
Is the inverse relationship properly set up?
Replies
Boosts
Views
Activity
Sep ’15
Reply to wrapping C++ std::strings in Objective-C/C++
With your fixed codes, I can eliminate many minor possibilities. Thus I can definately say, what is bad with your code is:NSString *Caller = Caller; string Call = [Caller UTF8String]; NSString *Sector = Sector; string Sect = [Sector UTF8String]; NSString *OutPut = OutPut; string OP = [OutPut UTF8String];In Objective-C, outside of @interface ... @end or @implementation ... @end is under global context.You are declaring global variables which have no relationship with the parameters of your method `TestCPP:::::::::` .And the three NSString variables, they are initilized with non-initialized themselves.(I am a little astonished with seeing Clang compiles this sort of initializations with no warnings.)So, the variables are very probably NULLs, so method calls in Objective-C like [Caller UTF8String] generates NULLs. I believe you cannot initialize std::string with NULL.Moving the 6 lines to inside the `TestCPP:::::::::` method would work. But if your main concern is bridging between C++ and Swift, I recom
Topic: Programming Languages SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’15
Reply to Cannot use class-only protocols as type parameters on swift
This issue seems like a compiler bug to me. The behavior seems to be that you can use a protocol to satisify a Generic type unless there is a protocol constaint on that type in which case only a concrete type can satisfy it. The compiler seems (in this use case) to be treating a protocol inherited from a base protocol as not conforming to that base protocol. If you remove the type constraint then all is well. Why can't a protocol satisfy a type constraint if it inherits from the constraining protocol?Can someone remark whether this is really the intended behavior?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’15
Reply to NSPredicate won't create where clause
What the error is stating is that the Core Data object you are trying to query does not have an attribute called bracket. I can see that you are attempting to access a faulted attribute called matches which probably has some additional bracket objects linked within but you will not be successful with this approach.Core Data just works a bit differently.If you want to test equality for a specific object then you might look at setting up the hash and isEqual functions for the custom object. However, even if you make that work you will find that performance degrades way beyond what you are expecting. You could also look at using the managedobjectid for the record and then querying those for a match. Again, your mileage may vary depending on how you plan to query this ~ equality queries are very expensive overall and with a lot of objects the performance will just shut down.I'd suggest you try creating a separate object that holds a single attribute value which can be search using a BEGINSWITH predicate. The sepa
Replies
Boosts
Views
Activity
Sep ’15