It might be helpful if you showed a bit more of the code you’re working on, so
that we can better see what you’re trying to do. Is there any operation in
particular that is slow?
Also, CC’ing swift-users since I think it belongs there.
Saagar Jha
> On Apr 18, 2017, at 22:57, Hbucius Smith via
Are you sure that's because it's defined in a protocol and not because it's a
`CGColor`. Can you try it with `UIColor`? I don't think CG types are supported
with `@IBInspectable`.
- Dennis
Sent from my iPhone
> On 19. Apr 2017, at 4:43 AM, Cavelle Benjamin via swift-users
> wrote:
>
> I don
I'm not sure exactly how class declarations interact with the scope of a
do{ } statement. I declare a new static function inside your do{ } scope
and it works fine, but something about the mapping of `==` and `!=` to
`isEqual` in NSObject seems to be confused by the scope of the do{ } block.
I'm n
Everyone should notice that in the do-block (Sample 2). The result is just
opposite of the code out of it (Sample 1). Or say, out the do-block, Swift
calls `==` directly. In the do-block, Swift just call `isEqual(_)` instead
of `==`.
That is the inconsistency I am confused.
Zhaoxin
On Wed, Apr 1
Your issue seems to be that you created a custom implementation for the
`==` operator but not one for the `!=` operator. If I add a custom
implementation for `!=` I get the results you expected. Tthe default
implementation of NSObject's `isEqual` is a test for identity, like the
`===` in Swift. So
I don’t post to this mailing list very often.
Working on updating my app to have a base set of code that cuts across macOS,
iOS, tvOS, watchOS
I’m writing a protocol to use across all the platforms that would be
“designable” inside Interface Builder, but I cannot make protocol variables
Inspec
Sample 1: both `==` and `!=` is true.
import Foundation
class Foo:NSObject {
let name:String
init(name:String) {
self.name = name
}
public static func ==(lhs: Foo, rhs: Foo) -> Bool {
guard type(of:lhs) == type(of:rhs) else { return false }
return
In my C-interop, I have a need to do this a lot:
typedef struct {
char message[LGS_MAX_MESSAGE_SIZE];
...other stuff...
} lgs_result_info_t;
func
callbackFailed(info inInfo: lgs_result_info_t)
{
var m = inInfo.message // *See note below
let message: String = withUnsafePointer
Ah, turns out the passed-in type is UnsafePointer, and I can
just call .pointee on that. That seems to have fixed my issues. Not sure if I'm
doing the rest of it wrong, but it's not crashing now, at least.
> On Apr 18, 2017, at 16:18 , Rick Mann via swift-users
> wrote:
>
> I'm trying to use
I'm trying to use an API with a complicated callback structure. You pass a
struct with a set of pointers to callbacks to a function, along with a pointer
to a buffer it fills out. Here's an elided version of the C and Swift code:
https://pastebin.com/k3VYJTjB
This compiles, but I get a
> On Apr 18, 2017, at 09:11 , Joe Groff wrote:
>
>
>> On Apr 17, 2017, at 6:19 PM, Rick Mann via swift-users
>> wrote:
>>
>> I'm trying to make a module out of a C library and header file. It has at
>> least one empty struct:
>>
>> struct lgs_context_t {};
>>
>> and a function:
>>
>> LGS
Oh goodness, I'm an idiot. I did not subclass NSObject. BTW, once I've
inherited from NSObject, is it still necessary to apply @objc?
And related, the ModuleName-Swift.h header that's generated isn't automatically
including the C header that's used by my Swift code (my Swift code wraps a C
API
Hey, Rick. I think we'd need a bit more information to really diagnose this—in
particular, the class declaration in Swift—but here are some possibilities:
- Classes that don't inherit from NSObject are not exposed to Objective-C
- Classes with any generic ancesters are not exposed to Objective-C,
> On Apr 17, 2017, at 10:11 PM, Rick Mann wrote:
>
>>
>> On Apr 17, 2017, at 08:54 , Joe Groff wrote:
>>
>>
>>> On Apr 14, 2017, at 7:41 PM, Rick Mann via swift-users
>>> wrote:
>>>
>>> I'm refactoring some Objective-C code to inherit from a new Swift super
>>> class. This has been going
> On Apr 17, 2017, at 6:19 PM, Rick Mann via swift-users
> wrote:
>
> I'm trying to make a module out of a C library and header file. It has at
> least one empty struct:
>
> struct lgs_context_t {};
>
> and a function:
>
> LGS_EXPORT struct lgs_context_t* lgs_init(const lgs_context_params_t
The error may be because of the missing symbol you saw earlier. The build has a
setting SWIFT_LINK_OBJC_RUNTIME which should default to NO on non-Darwin
systems, but I don't know how the detection works on FreeBSD.
The symbol is being emitted by the clang compiler and it seems to think there's
16 matches
Mail list logo