Guest User

Untitled

a guest
Feb 22nd, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. // Objc header
  2.  
  3. @import Realm;
  4.  
  5. @interface Profile : RLMObject
  6. @property NSString *name;
  7. @end
  8.  
  9. RLM_ARRAY_TYPE(Profile)
  10.  
  11. @interface Account : RLMObject
  12. @property RLMArray<Profile *><Profile> *profiles;
  13. @end
  14.  
  15. // generated swift 3 interface
  16.  
  17. import Realm
  18.  
  19. open class Profile : RLMObject {
  20.  
  21. open var name: String!
  22. }
  23.  
  24. public protocol ProfileProtocol : NSObjectProtocol {
  25. }
  26.  
  27. open class Account : RLMObject {
  28.  
  29. open var profiles: RLMArray<Profile>!
  30. }
  31.  
  32. // generated swift 4 interface
  33.  
  34. import Realm
  35.  
  36. open class Profile : RLMObject {
  37.  
  38. open var name: String!
  39. }
  40.  
  41. public protocol ProfileProtocol : NSObjectProtocol {
  42. }
  43.  
  44. open class Account : RLMObject {
  45.  
  46. open var profiles: (RLMArray<Profile> & ProfileProtocol)!
  47. }
  48.  
  49. // Code failing
  50.  
  51. let account = Account()
  52. let profile = Profile()
  53. profile.name = "bob"
  54. account.profiles.add(profile)
  55. for profile in account.profiles { // Type '(RLMArray<Profile> & ProfileProtocol)!' does not conform to protocol 'Sequence'
  56. debugPrint(profile)
  57. }
Add Comment
Please, Sign In to add comment