1// Copyright 2014 The Go Authors.  All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package objc
6
7import (
8	"ObjC/Foundation"
9	"ObjC/Foundation/NSMutableString"
10	"ObjC/NetworkExtension/NEPacket"
11	"ObjC/UIKit"
12)
13
14type GoNSDate struct {
15	Foundation.NSDate
16	this Foundation.NSDate
17}
18
19func (d *GoNSDate) Hash(this Foundation.NSDate) int {
20	return 0
21}
22
23type GoNSObject struct {
24	C Foundation.NSObjectC // The class
25	P Foundation.NSObjectP // The protocol
26}
27
28func (o *GoNSObject) Description(this Foundation.NSObjectC) string {
29	return ""
30}
31
32func DupNSDate(date Foundation.NSDate) Foundation.NSDate {
33	return date
34}
35
36type GoUIResponder struct {
37	UIKit.UIResponder
38}
39
40func (r *GoUIResponder) PressesBegan(_ Foundation.NSSet, _ UIKit.UIPressesEvent) {
41}
42
43const NSUTF8StringEncoding = 8
44
45func CreateReadNSMutableString() {
46	myData := []byte{'A', 'B'}
47	// Test byte slices. Use NSMutableString because NSString is
48	// represented as Go strings in bindings.
49	// Pass slice from Go to native.
50	mString := NSMutableString.NewWithData(myData, uint(NSUTF8StringEncoding))
51	// Pass slice from native to Go.
52	_ = mString.DataUsingEncoding(uint(NSUTF8StringEncoding))
53}
54
55// From <sys/socket.h>
56const PF_INET = 2
57
58func CallUcharFunction() {
59	_ = NEPacket.NewWithData(nil, uint8(PF_INET))
60}
61