Skip to content

Commit

Permalink
fix warning about header cast, fix podspec
Browse files Browse the repository at this point in the history
  • Loading branch information
DenTelezhkin committed Sep 13, 2015
1 parent a571039 commit 3f86c81
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DTTableViewManager.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Pod::Spec.new do |s|
s.authors = { 'Denys Telezhkin' => 'denys.telezhkin@yandex.ru' }
s.social_media_url = 'https://twitter.com/DTCoder'
s.source = { :git => 'https://github.com/DenHeadless/DTTableViewManager.git', :tag => s.version.to_s }
s.source_files = 'DTTableViewManager'
s.source_files = 'DTTableViewManager/**/*.{h,swift}'
s.requires_arc = true
s.ios.deployment_target = '8.0'
s.ios.frameworks = 'UIKit', 'Foundation'
Expand Down
20 changes: 14 additions & 6 deletions DTTableViewManager/TableViewFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,24 @@ class TableViewFactory
func headerFooterViewWithMapping(mapping: ViewModelMapping, unwrappedModel: Any) -> UIView?
{
let viewClassName = RuntimeHelper.classNameFromReflection(mapping.viewTypeMirror)
var view = self.tableView.dequeueReusableHeaderFooterViewWithIdentifier(viewClassName) as? UIView
if view == nil {
if let view = self.tableView.dequeueReusableHeaderFooterViewWithIdentifier(viewClassName) {
mapping.updateBlock(view,unwrappedModel)
return view
}
else {
let view : UIView?
if let type = mapping.viewTypeMirror.value as? UIView.Type {
view = type.dt_loadFromXibInBundle(bundle)
}
else {
view = nil
}

precondition(view != nil,"failed creating view of type: \(viewClassName) for model: \(unwrappedModel)")

mapping.updateBlock(view!,unwrappedModel)
return view
}
precondition(view != nil,"failed creating view of type: \(viewClassName) for model: \(unwrappedModel)")

mapping.updateBlock(view!,unwrappedModel)
return view
}

private func headerFooterViewOfType(type: ViewType, model : Any) -> UIView?
Expand Down

0 comments on commit 3f86c81

Please sign in to comment.