title: Should I use repository for Realm(ios)
body: <p>First of all I'm relatively new in ios and have no any experience using mobile dbs.</p>
  
  <p>Wanted to integrate into my app Realm(swift) and wonder if it make sense to have service layer and repository separated or everything just include into the service.</p>
  
  <p>Some example to have a good view.</p>
  
  <pre><code>class UserService {
  
      var userRepository: UserRepository!
  
      func findById(userId: String) -&gt; User? {
          return userRepository.findById(userId: userId)
      }
  }
  
  class UserRepository {
  
      private let realm = try! Realm()
  
      func findById(userId: String) -&gt; User? {
          return realm.object(ofType: User.self, forPrimaryKey: userId)
      }
  }
  </code></pre>