質問編集履歴

1

すみません、coredataの定義を追加しました。

2020/11/04 07:21

投稿

yukari_39
yukari_39

スコア23

test CHANGED
File without changes
test CHANGED
@@ -348,6 +348,78 @@
348
348
 
349
349
  ```
350
350
 
351
+ ```
352
+
353
+ import Foundation
354
+
355
+ import CoreData
356
+
357
+
358
+
359
+ extension Singer {
360
+
361
+
362
+
363
+ @nonobjc public class func fetchRequest() -> NSFetchRequest<Singer> {
364
+
365
+ return NSFetchRequest<Singer>(entityName: "Singer")
366
+
367
+ }
368
+
369
+
370
+
371
+ @NSManaged public var firstName: String?
372
+
373
+ @NSManaged public var lastName: String?
374
+
375
+
376
+
377
+ var wrappedFirstName: String {
378
+
379
+ firstName ?? "Unknown"
380
+
381
+ }
382
+
383
+
384
+
385
+ var wrappedLastName: String {
386
+
387
+ lastName ?? "Unknown"
388
+
389
+ }
390
+
391
+
392
+
393
+ }
394
+
395
+
396
+
397
+ extension Singer : Identifiable {
398
+
399
+
400
+
401
+ }
402
+
403
+ ```
404
+
405
+ ```
406
+
407
+ import Foundation
408
+
409
+ import CoreData
410
+
411
+
412
+
413
+ @objc(Singer)
414
+
415
+ public class Singer: NSManagedObject {
416
+
417
+
418
+
419
+ }
420
+
421
+ ```
422
+
351
423
 
352
424
 
353
425
  ### 試したこと