UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Core Data - Model for date and hour

Forums > SwiftUI

Hello I'm a french beginer in dev SwiftUI. (iOS14) I work on my app since multiple month, thanks to Hacking with Swift.

But for now I don't find how I have to deal with my Core Data model.

I need to store in core data a relationship with Date, hour, and associated data. Is like 3 time in the day for the morning at 8am, 12am and 7pm. I don't know how define my core data model.

  • I can store Date and hour in one Attribute, but how use predicate to filter multiple day at 8am ?

  • Or I can store Date in one dedicated Attribute meaning 3 time the same date by day and another Atribute only for the hour, but in this case witch format I must use for this Attribute, hour not exist ? It's seems possible in this case to predicate for a specific hour for all the day.

If you may help me :) Thanks you

2      

Hello I think I will try with 2 Attributes: one dedicated to the date one dedicated to the hours

I hope it's the correct way.

2      

Could you describe your use case and what you want to achieve? I have difficulties to get my head around what your goal is.

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.