Last active
January 28, 2016 13:08
-
-
Save diegosanchezr/0d733408e2e49817cdf8 to your computer and use it in GitHub Desktop.
Crash Xcode 7.3 b2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
public class BaseCellT<BubbleViewType where BubbleViewType:UIView>: UICollectionViewCell { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
self.bubbleView = self.createBubbleView() | |
} | |
public private(set) var bubbleView: BubbleViewType! | |
func createBubbleView() -> BubbleViewType! { | |
assert(false, "Override in subclass") | |
return nil | |
} | |
} | |
public final class PhotoCell: BaseCellT<UIImageView> { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
} | |
override func createBubbleView() -> UIImageView! { | |
return UIImageView() | |
} | |
} | |
public final class TextCell: BaseCellT<UIView> { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
} | |
override func createBubbleView() -> UIView! { | |
return UIView() | |
} | |
} | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let photoCell = PhotoCell(frame: CGRect.zero) | |
let textCell = TextCell(frame: CGRect.zero) | |
print(photoCell) | |
print(textCell) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Random EXC_BAD_ACCESS