Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

No type named 'Boolean' in module 'Swift'
Just downloaded Beta 4 of XCode 8 and ran the language conversion on an app that was already converted with Beta 3. I'm now getting an error with the following line (from SwiftyJSON) that was not changed during the conversion:extension JSON : Swift.Boolean { ....}I'm getting the error No type named 'Boolean' in module 'Swift'. If I change it to Swift.Bool I get - Inheritance from non-protocol type 'Bool'. Makes sense cause Bool is a struct rather than a class or a protocol. So this app is stuck. Anyone know of a workaround for this?TIAMike
7
0
3.3k
Aug ’16
Stop animation on sublayer.
When applying an animation to a layer with a sublayer, how do you prevent the sublayer from inheriting the animation?I've tried .removeAllAnimations on the sublayer, both after adding the animation and in the animationDidStart() delegate.I think it has something to do wih the layer being copied when the animation is applied, but still can't figure out a solution.
1
0
655
Aug ’16
Reply to UIVisualEffectView with mask doesn’t blur in iOS 10
Hello,i have the following view hierarchies:1)UIView (clearColor background) |---UIView (clearColor background) |--- BlurView (inherits UIVisualEffectsView)2)UIView (clearColor background) |--- BlurView (inherits UIVisualEffectsView)3)UIViewController |---MKMapView |--- .... some other views |---UIView == 1) |---UIView == 2)The code if the blurView is as follows:class BlurView: UIVisualEffectView { var cornersToRound = UIRectCorner.AllCorners private override init(effect: UIVisualEffect?) { super.init(effect: effect) } convenience init(effect: UIVisualEffect?, corners: UIRectCorner) { self.init(effect: effect) cornersToRound = corners translatesAutoresizingMaskIntoConstraints = false } required init?(coder aDecoder: NSCoder) { fatalError(init(coder:) has not been implemented) } override func layoutSubviews() { super.layoutSubviews() let radius = kDefaultCornerRadius let path = UIBezierPath(roundedRect:bounds, byRoundingCorners:cornersToRound, cornerRadii: CGSizeMake(radius, radius)) let shap
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’16
Reply to Stop animation on sublayer.
Sublayers don't inherit animations from their parent. More than likely you are animating something that affects the entire layer tree (such as transform or opacity and the like). There is no way to prevent these from affecting sublayers because thats part of the rendering model.
Topic: Media Technologies SubTopic: Audio Tags:
Aug ’16
Reply to Swift NSOutputStream not outputting full base64 string
So with this example string it should send with length 510368 however .write returns only 490272 characters.This is allowed behaviour per the write(_:maxLength:) documentation. The correct response (for a caller that’s using NSStream synchronously) is to look at how many bytes were sent and then call write(_:maxLength:) again to transmit the remaining bytes. This API design, which admittedly is a little weird, was inherited from the underlying UNIX system call, write. IMPORTANT This behaviour explains why the second parameter is named maxLength, not length. In many cases write is all or nothing. However, when dealing with TCP connections you have to allow for “short writes”. What’s happening under the covers here is that write has copied data into the kernel socket buffer up to the point that it’s become full. At that point write has two choices: it could block waiting for more space to become available in the kernel socket buffer (that is, for data to go over the wire and be ACK’d by the remote peer
Aug ’16
Reply to Using Multiple Managed Object Contexts
Well, that sort of gets at the heart of what I don't understand. Let me explain my concern (which will probably point out what I don't understand about MOCs):Suppose we have a CD (sqlite) database containing entities X, Y, Z, etc. (And of course, there are all sorts of relationships between them, but that's not relevant here.) The UI is built around a UITabBarController; view A (invoked by the first tab bar button) displays a list of Xs, backed by a FetchedResultsController. View B (invoked by the second tab bar button) displays a list of Ys, backed by a different FetchedResultsController (and, obviously, a different FetchRequest). And, just for fun, view C (invoked by the third tab bar button) displays a list of X's backed by another FetchedResultsController and a different FetchRequest than the one used in View A.Now my naive view of CD suggests that I can't use the same MOC for all three of these views, because each of the three FetchRequests change the internal content of the MOC. I.e., suppose w
Aug ’16
Reply to Using Multiple Managed Object Contexts
I've never made an app designed like what you are suggesting...but I would expect that all three fetched results controllers should be able to use the same managed object context.If there are relationships between the items...when a change is made in the managed object context say from view B that would have some sort of effect on view A, I would expect thatthe fetched results controller backing view A would pick up the change via the NSFetchedResultsControllerDelegate (assuming you set this up properly).Perhaps you'd want to suspend the view controllers from syncing with their fetched results controller when it is offscreen for performance reasons (and refetch when you come back like you suggessted). But I don't see why all three view controllers cannot share the same MOC. That's how I'd likely try doing it. If you have to do some work on the background to avoid blocking the UI, you could create a background context...just make sure you merge the changes with the main thread context.
Aug ’16
Avoiding SKView Stretching During Layout Animations
My app has an SKView instance in a view hierarchy that needs to support layout changes at run time (device orientation changes, window bounds changes when multitasking, et cetera). SKView inherits the contentMode property from UIView, so you can choose the drawing behavior during these animations, but the closest option (UIViewContentMode.center) still clips part of the presented scene during the animation, while UIViewContentMode.redraw doesn't have any visible effect.Can anyone offer a way of doing this with the current API? If it's not currently possible, I'll file a bug report.
2
0
514
Aug ’16
Core Data generates invalid SQL statement
I have been having issues with the app crawling to a hault. After much agony, I was able to narrow the cause down to this: Core Data generates an invalid SQL statement and Core Data disconnect from SQL DB, then tries to recover only to fail again. The invalid SQL statement that caused the connection to end is:CoreData: sql: SELECT Z_PK, Z_ENT, ZNODEID, ZALBUMID FROM ZNODE WHERE (ZNODEID IN (? , ? , ? ) OR (ZALBUMID IN (? , ? , ? ))Please note the extra ( before ZALBUMID. Either that or we can remove open parenthesis before ZNODEID and it will work.The error I am getting is:2016-08-05 23:24:25.858 STV[31710:5515735] CoreData: annotation: Disconnecting from sqlite database due to an error.2016-08-05 23:24:25.859 STV[31710:5515735] CoreData: error: (1) I/O error for database at /Users/skim/Library/Developer/CoreSimulator/Devices/E4B4DE09-F416-4792-AD35-550A38EAF6E2/data/Containers/Shared/AppGroup/FA274416-D266-41D3-84C1-D6AAE22D76F8/Library/Caches/STV.sqlite. SQLite error code:1, 'near ): syntax error'2016-08-05
2
0
880
Aug ’16
Reply to Learning Core Data sanity check
What I would do, as a first try is:An entity to identify each person, say Person with: Relationship (to many) to SurveyQuestionAnswerWhatever attributes neededAn entity to identify each question, say SurveyQuestionWhatever attributes the question needs, such as question textAn entity for each answer, say SurveyQuestionAnswer, with: Relationship (to one) to PersonRelationship (to one) to SurveyQuestionAttribute to represent the answer enteredWhatever other attributes are needed, such as the time the answer was enteredMaybe that's overkill if you're just storing yes/no answers, but it gives you the ability to examine answers either on a per-person basis or on a per-question basis.But this is really the point where you need to be deciding what you're going to be using the data for.
Aug ’16
XCode Visual Inheritance
Hello everybody,Just a quick question. Does XCode support visual inheritance? For example if i have an NSWindow which I need to subclass (as it is a common window in the app i need to build), will it's conrols appear on the subclassed one?I've tried several stuff on this, but i could not manage to get it working. Maybe I am missing something. Does anybody have an idea or came across the same case? Any help would be appreciated!
1
0
219
Aug ’16
Reply to Xcode 8 beta 4 - Crash when code generating CoreData objects
I'm getting the error as well but it seems to be a to-many relationship for me. For a while I thought it was caused by two entities having to-many relations to the same third entity. I can build if the relation is to-one, but when I try to change it so it's a to-many relation it crashes on the build. I *thought* that's what it was, but then I started over with a small sample with just three entities and the converging to-many relations and it didn't crash 😟I'll try generating the code and changing it after switching the generator off.Mike
Topic: App & System Services SubTopic: Core OS Tags:
Aug ’16
Reply to NEAppProxyProvider: instances, properties and statics
However, any static variables retain their values the next time that the AppProxy is started.That’s not a huge surprise. Starting a process is (relatively) expensive, so it’s reasonable for the Network Extension infrastructure to reuse an existing extension process if an appropriate one is lying around. And if your NEProvider instance is created in the same process as some previous one, it’ll share its static variables.This behaviour is common to all extensions, network and otherwise, because it’s inherited from the underlying XPC Service infrastructure.Singletons in particular will break if you are using the common pattern:I don’t consider that to be ‘broken’. The definition of a singleton is that there’s only one instance per process, and that’s what’s happening here. If you don’t want that, don’t use a singleton.Regardless of the above, you should consider avoiding singletons for other reasons (most importantly, to enhance testability).Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relation
Aug ’16
No type named 'Boolean' in module 'Swift'
Just downloaded Beta 4 of XCode 8 and ran the language conversion on an app that was already converted with Beta 3. I'm now getting an error with the following line (from SwiftyJSON) that was not changed during the conversion:extension JSON : Swift.Boolean { ....}I'm getting the error No type named 'Boolean' in module 'Swift'. If I change it to Swift.Bool I get - Inheritance from non-protocol type 'Bool'. Makes sense cause Bool is a struct rather than a class or a protocol. So this app is stuck. Anyone know of a workaround for this?TIAMike
Replies
7
Boosts
0
Views
3.3k
Activity
Aug ’16
Stop animation on sublayer.
When applying an animation to a layer with a sublayer, how do you prevent the sublayer from inheriting the animation?I've tried .removeAllAnimations on the sublayer, both after adding the animation and in the animationDidStart() delegate.I think it has something to do wih the layer being copied when the animation is applied, but still can't figure out a solution.
Replies
1
Boosts
0
Views
655
Activity
Aug ’16
Reply to NSCollectionViewLayout horizontal and vertical scrolling
I believe it has some relationship with auto layout. I could not figure out any clue yet.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Aug ’16
Reply to UIVisualEffectView with mask doesn’t blur in iOS 10
Hello,i have the following view hierarchies:1)UIView (clearColor background) |---UIView (clearColor background) |--- BlurView (inherits UIVisualEffectsView)2)UIView (clearColor background) |--- BlurView (inherits UIVisualEffectsView)3)UIViewController |---MKMapView |--- .... some other views |---UIView == 1) |---UIView == 2)The code if the blurView is as follows:class BlurView: UIVisualEffectView { var cornersToRound = UIRectCorner.AllCorners private override init(effect: UIVisualEffect?) { super.init(effect: effect) } convenience init(effect: UIVisualEffect?, corners: UIRectCorner) { self.init(effect: effect) cornersToRound = corners translatesAutoresizingMaskIntoConstraints = false } required init?(coder aDecoder: NSCoder) { fatalError(init(coder:) has not been implemented) } override func layoutSubviews() { super.layoutSubviews() let radius = kDefaultCornerRadius let path = UIBezierPath(roundedRect:bounds, byRoundingCorners:cornersToRound, cornerRadii: CGSizeMake(radius, radius)) let shap
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’16
Reply to Xcode 8 beta 4 - Crash when code generating CoreData objects
Yeah I just got a chance to confirm that. to-one relationships seems to be the trigger for the assert... kinda prevent prevents it from being useful since my model is riddled with to-one relationships.Now if I can find a way to restore/download Xcode 8 beta 3 I could make progress on my prototype.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’16
Reply to Stop animation on sublayer.
Sublayers don't inherit animations from their parent. More than likely you are animating something that affects the entire layer tree (such as transform or opacity and the like). There is no way to prevent these from affecting sublayers because thats part of the rendering model.
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Aug ’16
Reply to Swift NSOutputStream not outputting full base64 string
So with this example string it should send with length 510368 however .write returns only 490272 characters.This is allowed behaviour per the write(_:maxLength:) documentation. The correct response (for a caller that’s using NSStream synchronously) is to look at how many bytes were sent and then call write(_:maxLength:) again to transmit the remaining bytes. This API design, which admittedly is a little weird, was inherited from the underlying UNIX system call, write. IMPORTANT This behaviour explains why the second parameter is named maxLength, not length. In many cases write is all or nothing. However, when dealing with TCP connections you have to allow for “short writes”. What’s happening under the covers here is that write has copied data into the kernel socket buffer up to the point that it’s become full. At that point write has two choices: it could block waiting for more space to become available in the kernel socket buffer (that is, for data to go over the wire and be ACK’d by the remote peer
Replies
Boosts
Views
Activity
Aug ’16
Reply to Using Multiple Managed Object Contexts
Well, that sort of gets at the heart of what I don't understand. Let me explain my concern (which will probably point out what I don't understand about MOCs):Suppose we have a CD (sqlite) database containing entities X, Y, Z, etc. (And of course, there are all sorts of relationships between them, but that's not relevant here.) The UI is built around a UITabBarController; view A (invoked by the first tab bar button) displays a list of Xs, backed by a FetchedResultsController. View B (invoked by the second tab bar button) displays a list of Ys, backed by a different FetchedResultsController (and, obviously, a different FetchRequest). And, just for fun, view C (invoked by the third tab bar button) displays a list of X's backed by another FetchedResultsController and a different FetchRequest than the one used in View A.Now my naive view of CD suggests that I can't use the same MOC for all three of these views, because each of the three FetchRequests change the internal content of the MOC. I.e., suppose w
Replies
Boosts
Views
Activity
Aug ’16
Reply to Using Multiple Managed Object Contexts
I've never made an app designed like what you are suggesting...but I would expect that all three fetched results controllers should be able to use the same managed object context.If there are relationships between the items...when a change is made in the managed object context say from view B that would have some sort of effect on view A, I would expect thatthe fetched results controller backing view A would pick up the change via the NSFetchedResultsControllerDelegate (assuming you set this up properly).Perhaps you'd want to suspend the view controllers from syncing with their fetched results controller when it is offscreen for performance reasons (and refetch when you come back like you suggessted). But I don't see why all three view controllers cannot share the same MOC. That's how I'd likely try doing it. If you have to do some work on the background to avoid blocking the UI, you could create a background context...just make sure you merge the changes with the main thread context.
Replies
Boosts
Views
Activity
Aug ’16
Avoiding SKView Stretching During Layout Animations
My app has an SKView instance in a view hierarchy that needs to support layout changes at run time (device orientation changes, window bounds changes when multitasking, et cetera). SKView inherits the contentMode property from UIView, so you can choose the drawing behavior during these animations, but the closest option (UIViewContentMode.center) still clips part of the presented scene during the animation, while UIViewContentMode.redraw doesn't have any visible effect.Can anyone offer a way of doing this with the current API? If it's not currently possible, I'll file a bug report.
Replies
2
Boosts
0
Views
514
Activity
Aug ’16
Core Data generates invalid SQL statement
I have been having issues with the app crawling to a hault. After much agony, I was able to narrow the cause down to this: Core Data generates an invalid SQL statement and Core Data disconnect from SQL DB, then tries to recover only to fail again. The invalid SQL statement that caused the connection to end is:CoreData: sql: SELECT Z_PK, Z_ENT, ZNODEID, ZALBUMID FROM ZNODE WHERE (ZNODEID IN (? , ? , ? ) OR (ZALBUMID IN (? , ? , ? ))Please note the extra ( before ZALBUMID. Either that or we can remove open parenthesis before ZNODEID and it will work.The error I am getting is:2016-08-05 23:24:25.858 STV[31710:5515735] CoreData: annotation: Disconnecting from sqlite database due to an error.2016-08-05 23:24:25.859 STV[31710:5515735] CoreData: error: (1) I/O error for database at /Users/skim/Library/Developer/CoreSimulator/Devices/E4B4DE09-F416-4792-AD35-550A38EAF6E2/data/Containers/Shared/AppGroup/FA274416-D266-41D3-84C1-D6AAE22D76F8/Library/Caches/STV.sqlite. SQLite error code:1, 'near ): syntax error'2016-08-05
Replies
2
Boosts
0
Views
880
Activity
Aug ’16
Reply to Learning Core Data sanity check
What I would do, as a first try is:An entity to identify each person, say Person with: Relationship (to many) to SurveyQuestionAnswerWhatever attributes neededAn entity to identify each question, say SurveyQuestionWhatever attributes the question needs, such as question textAn entity for each answer, say SurveyQuestionAnswer, with: Relationship (to one) to PersonRelationship (to one) to SurveyQuestionAttribute to represent the answer enteredWhatever other attributes are needed, such as the time the answer was enteredMaybe that's overkill if you're just storing yes/no answers, but it gives you the ability to examine answers either on a per-person basis or on a per-question basis.But this is really the point where you need to be deciding what you're going to be using the data for.
Replies
Boosts
Views
Activity
Aug ’16
XCode Visual Inheritance
Hello everybody,Just a quick question. Does XCode support visual inheritance? For example if i have an NSWindow which I need to subclass (as it is a common window in the app i need to build), will it's conrols appear on the subclassed one?I've tried several stuff on this, but i could not manage to get it working. Maybe I am missing something. Does anybody have an idea or came across the same case? Any help would be appreciated!
Replies
1
Boosts
0
Views
219
Activity
Aug ’16
Reply to Xcode 8 beta 4 - Crash when code generating CoreData objects
I'm getting the error as well but it seems to be a to-many relationship for me. For a while I thought it was caused by two entities having to-many relations to the same third entity. I can build if the relation is to-one, but when I try to change it so it's a to-many relation it crashes on the build. I *thought* that's what it was, but then I started over with a small sample with just three entities and the converging to-many relations and it didn't crash 😟I'll try generating the code and changing it after switching the generator off.Mike
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’16
Reply to NEAppProxyProvider: instances, properties and statics
However, any static variables retain their values the next time that the AppProxy is started.That’s not a huge surprise. Starting a process is (relatively) expensive, so it’s reasonable for the Network Extension infrastructure to reuse an existing extension process if an appropriate one is lying around. And if your NEProvider instance is created in the same process as some previous one, it’ll share its static variables.This behaviour is common to all extensions, network and otherwise, because it’s inherited from the underlying XPC Service infrastructure.Singletons in particular will break if you are using the common pattern:I don’t consider that to be ‘broken’. The definition of a singleton is that there’s only one instance per process, and that’s what’s happening here. If you don’t want that, don’t use a singleton.Regardless of the above, you should consider avoiding singletons for other reasons (most importantly, to enhance testability).Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relation
Replies
Boosts
Views
Activity
Aug ’16