| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package objcpkg |
| 6 |
|
| 7 |
import ( |
| 8 |
"ObjC/Foundation" |
| 9 |
gopkg "ObjC/Objcpkg" |
| 10 |
"ObjC/UIKit" |
| 11 |
) |
| 12 |
|
| 13 |
const ( |
| 14 |
DescriptionStr = "Descriptrion from Go" |
| 15 |
Hash = 42 |
| 16 |
) |
| 17 |
|
| 18 |
type GoNSDate struct { |
| 19 |
Foundation.NSDate |
| 20 |
} |
| 21 |
|
| 22 |
func (d *GoNSDate) Hash(self gopkg.GoNSDate) int { |
| 23 |
return Hash |
| 24 |
} |
| 25 |
|
| 26 |
func (d *GoNSDate) Description(self gopkg.GoNSDate) string { |
| 27 |
|
| 28 |
if h := self.Hash(); h != Hash { |
| 29 |
panic("hash mismatch") |
| 30 |
} |
| 31 |
return DescriptionStr |
| 32 |
} |
| 33 |
|
| 34 |
func (d *GoNSDate) GetSelf(self gopkg.GoNSDate) Foundation.NSDate { |
| 35 |
return self |
| 36 |
} |
| 37 |
|
| 38 |
func NewGoNSDate() *GoNSDate { |
| 39 |
return new(GoNSDate) |
| 40 |
} |
| 41 |
|
| 42 |
type GoNSObject struct { |
| 43 |
C Foundation.NSObjectC |
| 44 |
P Foundation.NSObjectP |
| 45 |
UseSelf bool |
| 46 |
} |
| 47 |
|
| 48 |
func (o *GoNSObject) Description(self gopkg.GoNSObject) string { |
| 49 |
if o.UseSelf { |
| 50 |
return DescriptionStr |
| 51 |
} else { |
| 52 |
return self.Super().Description() |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
func DupNSDate(date Foundation.NSDate) Foundation.NSDate { |
| 57 |
return date |
| 58 |
} |
| 59 |
|
| 60 |
type GoUIResponder struct { |
| 61 |
UIKit.UIResponder |
| 62 |
Called bool |
| 63 |
} |
| 64 |
|
| 65 |
func (r *GoUIResponder) PressesBegan(_ Foundation.NSSet, _ UIKit.UIPressesEvent) { |
| 66 |
r.Called = true |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
func implicitType(r UIKit.UIResponder) { |
| 71 |
r.MotionBegan(0, nil) |
| 72 |
} |