Sean Keane
01/16/2020, 7:22 PMasarazan
01/16/2020, 8:02 PMGarouDan
01/18/2020, 9:56 PMxcode
block from the kotlin("xcode-compat")
plugin in order to achieve that?
For example, with this
xcode {
setupFramework("KotlinNativeFramework")
}
a directory called KotlinNativeFramework will be created inside of the build folder, but the actual frameworks inside of this folder (*.framework
, *.framework.dSYM
) have a much longer name and also their inner definitions will be pointing to this other name.
It looks like tha name come from the linkTask but I don’t know how to change the output definitions, does someone know?Trond Tunheim
01/22/2020, 1:32 PMfcosta
01/23/2020, 4:42 PMdarkmoon_uk
01/26/2020, 1:05 AMHenrik
01/28/2020, 9:32 AMval contents = "File contents"
val filename = "some.file"
val res = contents.writeToFile(filename, true, NSUTF8StringEncoding)
I have succeeded using the simpler overload without encoding end error, but the NSError*/throws
is causing me problems. How can I supply/catch that parameter from Kotlin?Romain Dubreucq
01/31/2020, 11:08 AMHenrik
02/04/2020, 8:04 AMTrond Tunheim
02/04/2020, 12:01 PMval image = UIImage("mypin")
The file mypin.png is copied into Assets.xcassets in Xcode . This doesn't work , it fails to load the image. Anyone that has any thoughts on how to do this correctly?Henrik
02/07/2020, 1:29 PMribesg
02/07/2020, 4:02 PMUIView.draw
?Samuel Michael
02/09/2020, 10:20 PMSamuel Michael
02/10/2020, 7:26 AMribesg
02/10/2020, 2:43 PMNSError
into a Throwable
?Nikolay Kasyanov
02/11/2020, 11:05 AMSam
02/13/2020, 7:47 PMRomain Dubreucq
03/02/2020, 4:45 PMgonzooin
03/10/2020, 12:50 PMsupportedInterfaceOrientations
Anyone know how to achieve this ?dazza5000
03/12/2020, 2:39 PMChristian Sousa
03/12/2020, 3:34 PMChristian Sousa
03/13/2020, 2:19 PMChristian Sousa
03/16/2020, 3:05 PMChristian Sousa
03/17/2020, 12:23 PMUnable to call non-designated initializer as super constructor
.
The code I have is:
private class Select: UITextField {
@OverrideInit
constructor(): super()
override fun caretRectForPosition(position: UITextPosition): CValue<CGRect> {
return CGRectMake(x = 0.0, y = 0.0, width = 0.0, height = 0.0)
}
override fun selectionRectsForRange(range: UITextRange): List<*> {
return listOf<Any?>(null)
}
override fun canPerformAction(action: COpaquePointer?, withSender: Any?): Boolean {
return false
}
}
Anyone know what should I do? I guess I could use disableDesignatedInitializerChecks
but that doesn’t seem rightphldavies
03/19/2020, 11:29 AMoverride fun locationManager(manager: CLLocationManager, didEnterRegion: CLRegion)
override fun locationManager(manager: CLLocationManager, didExitRegion: CLRegion)
override fun locationManager(manager: CLLocationManager, didStartMonitoringForRegion: CLRegion)
Christian Sousa
03/25/2020, 6:24 PMprivate fun generateViewWithShadow(): UIView {
var generatedView = UIView().apply {
translatesAutoresizingMaskIntoConstraints = false
heightAnchor.constraintEqualToConstant(60.0).active = true
}
var size = CGSizeMake(20.0, 20.0)
var offsetVal = CGSizeMake(2.0, 2.0)
var layerPath = UIBezierPath.bezierPathWithRoundedRect(rect= generatedView.bounds, byRoundingCorners = UIRectCornerAllCorners, cornerRadii = size ).CGPath
var shadowLayer = CAShapeLayer().apply {
path = layerPath
fillColor = UIColor.whiteColor.CGColor
shadowColor = UIColor.blackColor.CGColor
shadowPath = layerPath
shadowOffset = offsetVal
shadowOpacity = 1.0F
shadowRadius = 5.0
}
generatedView.layer.addSublayer(shadowLayer)
return generatedView
}
Looking at some swift code, I guess that my translation to kotlin is correct, but I still dont get what it should output.. any ideas?Matouš Skála
03/28/2020, 1:35 PMRostislav Utrobin
04/02/2020, 5:57 AMmagnumrocha
04/08/2020, 8:00 AMpublic func isConnectedToNetwork() -> Bool {
var zeroAddress = sockaddr_in()
zeroAddress.sin_len = UInt8(MemoryLayout<sockaddr_in>.size)
zeroAddress.sin_family = sa_family_t(AF_INET)
guard let defaultRouteReachability = withUnsafePointer(to: &zeroAddress, {
$0.withMemoryRebound(to: sockaddr.self, capacity: 1) {
SCNetworkReachabilityCreateWithAddress(nil, $0)
}
}) else {
return false
}
var flags: SCNetworkReachabilityFlags = []
if !SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags) {
return false
}
if flags.isEmpty {
return false
}
let isReachable = flags.contains(.reachable)
let needsConnection = flags.contains(.connectionRequired)
return (isReachable && !needsConnection)
}
Rostislav Utrobin
04/08/2020, 8:37 AMspec.script_phases = [
{
:name => 'Build multiplatform',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" :multiplatform:syncFramework \
-Pkotlin.native.cocoapods.target=$KOTLIN_TARGET \
-Pkotlin.native.cocoapods.configuration=RELEASE \
-Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS" \
-Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS" \
-Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"
SCRIPT
}
]
When I build my ios project it runs syncFramework
task and I don’t understand how syncFramework works.
Here are few examples:
1. I add some println("")
inside a SharedCode function and when I build ios project the syncFramework
does nothing. (I don’t see my println at runtime)
2. I change some function name fun test()
-> fun myTest()
then Xcode says test()
func isn’t exist and if I change it to myTest()
it compiles and crushes at runtime with unrecognized selector sent to instance
For now the only way to rebuild all the project it to delete the build folder from SharedCode and run Xcode build again.
Does it work as expected?Rostislav Utrobin
04/08/2020, 8:37 AMspec.script_phases = [
{
:name => 'Build multiplatform',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" :multiplatform:syncFramework \
-Pkotlin.native.cocoapods.target=$KOTLIN_TARGET \
-Pkotlin.native.cocoapods.configuration=RELEASE \
-Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS" \
-Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS" \
-Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"
SCRIPT
}
]
When I build my ios project it runs syncFramework
task and I don’t understand how syncFramework works.
Here are few examples:
1. I add some println("")
inside a SharedCode function and when I build ios project the syncFramework
does nothing. (I don’t see my println at runtime)
2. I change some function name fun test()
-> fun myTest()
then Xcode says test()
func isn’t exist and if I change it to myTest()
it compiles and crushes at runtime with unrecognized selector sent to instance
For now the only way to rebuild all the project it to delete the build folder from SharedCode and run Xcode build again.
Does it work as expected?magnumrocha
04/08/2020, 8:40 AMsyncFramework
task basically make a copy of the produced framework on your KMP module build folder to the Pod local framework foldersyncFramework
task is added as a build step in XCode for the Pod that represents your library....Rostislav Utrobin
04/08/2020, 8:46 AMmagnumrocha
04/08/2020, 8:47 AMsyncFramework
task depends on build
task in gradlebuild
will runs before the syncFramework
Rostislav Utrobin
04/08/2020, 8:52 AMbuild
task understand that code was changed and it should recompile the framework ?magnumrocha
04/08/2020, 8:54 AMRostislav Utrobin
04/08/2020, 9:01 AMbuild
task sees the code was changed and recompile it (or just uses existed code if wasn’t changed)magnumrocha
04/08/2020, 9:03 AMXCode build
-> KMP Pod build
-> syncFramework
-> KMP Lib build in gradle
(if not already build)Rostislav Utrobin
04/08/2020, 9:11 AMXcode build
-> KMP Pod build
-> syncFramework
-> KMP Lib build in gradle
(if not already built or my KMP code has any changes since last build)magnumrocha
04/08/2020, 9:17 AM